I\'m trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a git push
. The response tells me that e
Try git add -A
instead of git add .
git push origin master
Right now, it appears as you are on the develop branch. Do you have a develop branch on your origin? If not, try git push origin develop
. git push
will work once it knows about a develop branch on your origin.
As further reading, I'd have a look at the git-push man pages, in particular, the examples section.
This happened to me once I tried to push from a new branch and I used git push origin master
instead.
You should either:
git push origin your_new_branch
if you want that this
branch occurs too in the remote repo.git merge origin master
.Recap: the point here is that you should check out where you offer on the second parameter for git merge. So if you are in the master use master as the second parameter if you are in the new_branch use this as the second parameter if you want to keep this branch in the remote repo else opt for the second option above instead.
git push
doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.
On my version of Git (1.6.5.3), when I run git remote show origin
it actually prints out which branches are configured for push:
Local refs configured for 'git push':
master pushes to master (up to date)
quux pushes to quux (fast forwardable)
Q. But I could push to master
without worrying about all this!
When you git clone
, by default it sets up your local master
branch to push to the remote's master
branch (locally referred to as origin/master
), so if you only commit on master
, then a simple git push
will always push your changes back.
However, from the output snippet you posted, you're on a branch called develop
, which I'm guessing hasn't been set up to push to anything. So git push
without arguments won't push commits on that branch.
When it says "Everything up-to-date", it means "all the branches you've told me how to push are up to date".
Q. So how can I push my commits?
If what you want to do is put your changes from develop
into origin/master
, then you should probably merge them into your local master
then push that:
git checkout master
git merge develop
git push # will push 'master'
If what you want is to create a develop
branch on the remote, separate from master
, then supply arguments to git push
:
git push origin develop
That will: create a new branch on the remote called develop
; and bring that branch up to date with your local develop
branch; and set develop
to push to origin/develop
so that in future, git push
without arguments will push develop
automatically.
If you want to push your local develop
to a remote branch called something other than develop
, then you can say:
git push origin develop:something-else
However, that form won't set up develop
to always push to origin/something-else
in future; it's a one-shot operation.
Please try going to the last commit and then do git push origin HEAD:master
.