git push操作時出現錯誤: error: insufficient permission for adding an object to repository database
這是在我push到我自己搭建的git伺服器上時出現的問題,原因伺服器倉庫沒有設定權限,是以push失敗。
我的git伺服器是搭建在ubuntu16.04上的。
解決辦法:
首先,在git伺服器所在的電腦上打開終端,輸入 whoami,得到自己的主機名字,例如我的主機名字是 admin
然後,假設我的git伺服器所在的路徑為 lujing/sample.git, 那麼,在lujing檔案夾下打開終端,輸入
sudo chown -R admin sample.git/
在sample.git下打開終端
git config --bool core.bare true
這樣就解決了權限問題。
接下來就可以在原來的電腦重新push代碼了。
參考連結:
https://stackoverflow.com/questions/2816369/git-push-error-remote-rejected-master-master-branch-is-currently-checked
https://stackoverflow.com/questions/6448242/git-push-error-insufficient-permission-for-adding-an-object-to-repository-datab