1. 程式人生 > >smartgit 因先建資料夾再建立遠端庫出現時的問題

smartgit 因先建資料夾再建立遠端庫出現時的問題

failed to push some refs to 'https://gitee.com/pengzesheng/cordova_jqmobile.git'
! refs/heads/master:refs/heads/master [rejected] (non-fast-forward)
hint: Updates were rejected because the tip of your current branch is behind
Done
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
'master' rejected (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/pengzesheng/cordova_jqmobile.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

在remote——》add遠端庫之後,點選push出現上面的提示,因為出現上下箭頭要先pull再push,但是卻沒有pull按鈕可點選,這時開啟專案下的.git(這個資料夾是隱藏的)找到config,新增

[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "origin"]

之後點選pull就會出現pull按鈕,接著commit,push,一切正常

PS:一開始沒有.gitignore資料夾也要自己建立,可從正常步驟的專案貼上過來