我有一臺安裝了Git的Linux服務器。我正在開發一個Web應用程序,我想在網站路徑(/ var/www/apps/myapp)上的服務器上創建一個git存儲庫,然後將我的本地存儲庫更改推送到它。使用非裸Git存儲庫更新服務器文件
當我創建了服務器非純倉庫,推動了變化,我得到這個錯誤:
Refusing to update checked out branch: refs/heads/master. By default, updating the current branch in a non-bare repository is denied, because it will make the index and work tree inconsistent with what you pushed, and will require 'git reset --hard' to match the work tree to HEAD. etc.
它建議使用裸存儲庫。我可以成功地做到這一點,但我的問題是,我希望我的服務器在推送更改時自動更新Web應用程序文件夾。據我瞭解,當我使用裸存儲庫時,我必須再次在服務器上克隆裸存儲庫以獲取真實文件。這樣我有3個存儲庫。兩個在服務器端(其中一個是裸露的),另一個在本地。
我只想要一個只讀存儲庫,我可以推送我的更改並更新服務器端的Web應用程序文件夾內容。
解決方案是什麼?
數據丟失不危險嗎? –
還有一些觀點:1)我沒有post-receive.sample,但有update-update後的樣例。 2)'pwd'是什麼意思? –
我使用'git push -f origin master',但結果相同。 –