[英]Git remote repository (with files?)
我有一個遠程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'.
有什么方法可以在我的筆記本電腦和遠程服務器上獲取工作副本?
謝謝
您可以(在服務器上)設置該選項:
git config receive.denyCurrentBranch ignore
或在服務器端使用兩個存儲庫。 一種是您推送到的裸倉庫。 另一個是非裸倉庫,它是裸倉庫的“工作副本”克隆。 您給裸倉庫一個提交后的鈎子,該鈎子將cd
插入您的工作副本並執行git pull
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.