Я немного git
новичок, и произошло следующее:
Я работал над проектом, создал ветку и с радостью зафиксировал код и отправил его на github, без проблем, затем в какой-то момент я изменил свое имя на github, т.е. я обновил свой пульт с помощью git remote set-url origin NEWURL
, я подтвердил с помощью remote -v
, но git push
все еще не удалось. Я попытался git rebase config_options/config_options
, после чего он сказал │fatal: Needed a single revision
, и я до сих пор не могу git push
, что еще нужно сделать??
$ git push To https://github.com/stdcerr/scaper.git !
[rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/stdcerr/scaper.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Я тоже пытался сделать git pull
, но у меня получается только Already up-to-date.
Я попробовал git pull --rebase
и получил следующее:
$ git pull --rebase
Current branch config_options is up to date.
ron@regDesktopHome:~/src/scaper$ git push
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 353 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/stdcerr/scaper.git
3747bbb..06a769e config_options -> config_options
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/stdcerr/scaper.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details
Это часто наблюдается, когда вы создаете новый репозиторий с фиксацией в нем (для исходных файлов README или LICENSE) вместо создания репозитория пустой (без фиксации и без файлов).
Если вы создаете пустой репозиторий, вы можете нажать без проблем.
Если нет, вам понадобится сначала git pull --rebase
, а затем git push --force
.