4
我敢肯定這是一個非常簡單的修復方法,但我不確定爲什麼我推送GitHub失敗。當git push失敗時,我能做些什麼......「本地過時」?
現在它看起來像:
$ git push origin master
To [email protected]:user_name/project_name.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:user_name/project_name.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
和:
$ git remote show origin
* remote origin
Fetch URL: [email protected]:user_name/project_name.git
Push URL: [email protected]:user_name/project_name.git
HEAD branch: master
Remote branch:
master tracked
Local ref configured for 'git push':
master pushes to master (local out of date)
此外,當我嘗試git的拉:
$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
use something like the following in your configuration file:
[branch "master"]
remote = <nickname>
merge = <remote-ref>
[remote "<nickname>"]
url = <url>
fetch = <refspec>
See git-config(1) for details.
我做了什麼導致這種狀態...我應該怎麼做才能解決這個問題?