Frage

So I recently tried to do the following in git:

Username for '##### - Site': User
Password for '##### - Site':
To https://comtech.git.beanstalkapp.com/ong-sis.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '##### - Site'
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 was like, ok - lets try and force this - BAD I KNOW BUT READ ON - my reasoning for this is because the master of the branch I am trying to push too has code I no longer care about - and I am the only one who pushes to this repo.

So I tried this:

$ git push --force SISONG master
Username for '##### - Site': user
Password for '##### - Site':
Counting objects: 190, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (110/110), done.
Writing objects: 100% (111/111), 599.75 KiB | 0 bytes/s, done.
Total 111 (delta 60), reused 40 (delta 1)
remote: error: denying non-fast-forward refs/heads/master (you should pull first
)
To https://comtech.git.beanstalkapp.com/ong-sis.git
 ! [remote rejected] master -> master (non-fast-forward)
error: failed to push some refs to '##### - Site'

So finally I decided, ya know what - lets pull - lets just do it and deal with the merge issues.

$ git pull SISONG master
Username for '##### - Site': user
Password for '##### - Site':
From ##### - Site
 * branch            master     -> FETCH_HEAD
Already up-to-date.

I'm sorry what?! So your up to date? ok fine push the damn stuff....

Now my company does not allow non-fast-forward pushes, and I cannot get ahold of the admin for this repo - any ideas?

War es hilfreich?

Lösung

You can't git push because the remote branch has diverged from what it should be according to your computer. Probably somebody else has pushed some code too. In order to resolve it, you need to git pull first and then git push again.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top