我在mac os x上啓用了ssh。我試圖推動本地更改爲遠程回購。我在本地模擬遠程回購這樣的:創建遠程回購Git推到裁判/頭/主無法在我的Mac,如何解決?
$cd ~/learn
$mkdir gittest
$cd gittest/
$git init
$git config --global user.name "username"
$git config --global user.email "useremail"
$touch readme
$git add readme
$git commit -m "empty"
OK,一切正常,然後在另一個目錄中,我所做的:
$cd ~/learn/client
$git clone [email protected]:/Users/trosky/learn/gittest
$cd gittest
$vi readme(add one line)
$git add .
$git commit -m "add line"
$git push origin master:refs/heads/master
它沒有和git說:
$git push origin master:refs/heads/master
Total 0 (delta 0), reused 0 (delta 0)
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: error: is denied, because it will make the index and work tree inconsistent
remote: error: with what you pushed, and will require 'git reset --hard' to match
remote: error: the work tree to HEAD.
remote: error:
remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
remote: error: its current branch; however, this is not recommended unless you
remote: error: arranged to update its work tree to match what you pushed in some
remote: error: other way.
remote: error:
remote: error: To squelch this message and still keep the default behaviour, set
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To [email protected]:/Users/trosky/gittest
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '[email protected]:/Users/trosky/learn/gittest'
這是否表明遠程回購或本地客戶端有問題?如何解決它?
該消息說明究竟發生了什麼,你能解釋它的哪一部分讓你感到困惑嗎? – jthill