git push操作出现错误: github error: insufficient permission for adding an object to repository database

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

猜你喜欢

转载自blog.csdn.net/guoyu137996643/article/details/80963288