On Tuesday, January 8, 2013 8:47:10 AM UTC+1, k-joseph wrote:

> Hi every one, am kindly requesting for your assistance, i successfully 
> push to a remote branch on my account for the first time( first push where 
> i use git push origin <name of the branch>) but when am pushing the second 
> or any other time except the first i normally get an error      
> $ git push
> Enter passphrase for key '/c/Users/kaweesi joseph/.ssh/id_rsa':
> error: src refspec refs/heads/trunk-3...@github.com <javascript:> does 
> not match any.
> error: failed to push some refs to 
> 'g...@github.com:k-joseph/openmrs-core.git'
> i have also tried using git push --all and i get
> $ git push --all
> Enter passphrase for key '/c/Users/kaweesi joseph/.ssh/id_rsa':
> Counting objects: 249, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (79/79), done.
> Writing objects: 100% (139/139), 24.36 KiB, done.
> Total 139 (delta 72), reused 99 (delta 45)
> To g...@github.com:k-joseph/openmrs-core.git
>    9b76cd3..9e4ba80  TRUNK-3814 -> TRUNK-3814
>  * [new branch]      TRUNK-2449 -> TRUNK-2449
>  * [new branch]      testing -> testing
>  ! [rejected]        master -> master (non-fast-forward)
> error: failed to push some refs to 
> 'g...@github.com:k-joseph/openmrs-core.git'
> hint: Updates were rejected because a pushed branch tip is behind its 
> remote
> hint: counterpart. Check out this branch and merge the remote changes
> hint: (e.g. 'git pull') before pushing again.
> hint: See the 'Note about fast-forwards' in 'git push --help' for details.
>
> So i have always been deleting the remote branch in order to succeed in 
> pushing my changes to a remote branch, i fill this is not the best way to 
> do this
> Please help me with a git command that i can use to push to a remote 
> branch the second, third or even more time without first deleting the 
> remote branch, thanks all
>
>
Git rejects the pushing of changes to master branch because your local 
master branch is not up-to-date or newer that what's on github. This 
typically happens when someone else pushes to github/master before you do, 
or when you are locally rewriting history that has already been pushed to 
github, and then you push again.

I'm not sure how you've achieved it exactly. Can you tell us some more 
about the operations or git commands you do regularly? 

Does this pushing problem occur after every commit? Are other people 
pushing to the same repository?

When the error occurs, you can either:

1) Overwrite your local master branch with what is remotely on github: git 
reset --hard origin/master, OR
2) Merge the remote master branch with your local one: basically do a git 
pull before pushing.

Of course, there probably is a root problem here in your process that leads 
you to into getting an outdated master branch all the time. 

-- 


Reply via email to