There are some details missing from the question, but I'll attempt to answer anyways. First of all, if you both have your own copies of the repo, then you both should be able to commit changes to your own local copies.
If your friend is trying to push his changes to your local repo, it sounds like it's not working because you currently have master
checked out, which would make sense as a safety feature...you wouldn't want to have Git silently swap out your working copy from right under your nose without warning. You can allow Git to move your master
branch/reference/label/pointer by checking out the commit it's on directly:
$ git checkout head
Then your friend would probably be able to push his changes to your repo. After he's done, be sure to checkout the master
branch again in your local repo (if you want to work on it):
$ git checkout master
However, people don't usually push changes to other people's personal/private repos. They usually send each other pull requests instead, and fetch
each other's changes. So you could add your friend's remote and fetch
his changes and then merge
them in (or pull
to do both):
$ git add <friend name> <url or path to friend remote>
$ git fetch <friend remote>
$ git merge <friend>/master
# Or combine fetch and merge using pull
$ git pull <friend> master
Alternatively, instead of fetching and merging (or pulling) your friend's changes into your local master
branch, you can rebase your local changes on top of his changes:
$ git fetch <friend remote>
$ git rebase <friend>/master master