Git远程存储库(带文件?)

时间:2010-08-15 18:26:20

标签: git synchronization

我有一个我可以完全访问的远程Web服务器(ssh,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 t
remote: error: 'ignore' or 'warn' in the remote repository to allow pushing int
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 som
remote: error: other way.
remote: error: 
remote: error: To squelch this message and still keep the default behaviour, se
remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

有没有办法在我的笔记本电脑和远程服务器上获得工作副本?

由于

1 个答案:

答案 0 :(得分:3)

您可以设置该选项(在服务器上):

git config receive.denyCurrentBranch ignore

或者在服务器端使用两个存储库。一个是您推送的裸存储库。另一个是非裸存储库,它是裸存储库的“工作副本”克隆。你给这个裸仓库提供一个cd到你工作副本的后提交钩子并执行git pull