如果您推入帶有結賬工作副本的遠程,您將不會自動查看更改。 git
正在將更改推送到存儲庫(.git
目錄)。如果要更新關聯的工作副本,則需要在post-update
鉤子中實現適當的邏輯。
一般來說,git
甚至不會讓你推與不明確的配置相關的工作拷貝遙控...你通常會發現線沿線的一個錯誤:
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 /home/lars/repo1
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '/home/lars/projects/administrivia/repo1'
要添加到此,你通常應該只推送由'git init --bare'創建的倉庫,並讓其他人從那裏抽取。或者,如果你不喜歡那樣,只需拉動,不要推。推動非裸回購是奇怪和蹩腳的。 – Dougal
http://sitaramc.github.com/concepts/bare.html 這是一個非常好的解決我的問題。 – Eekhoorn
難道這是舊版git版本的問題嗎?我的工作場所有git版本1.5.6.5,而在我的Mac上運行1.7.4.4。 – Eekhoorn