权限不足的Git推送错误,无法写入对象

时间:2015-09-26 16:06:03

标签: git git-push

我在我自己的服务器上有一个Git仓库(Ubuntu 14.04),一切都运行正常,但是现在如果我尝试将一些提交从服务器推送到服务器上的repo我得到了这个错误:

Counting objects: 51, done.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (26/26), 2.78 KiB | 0 bytes/s, done.
Total 26 (delta 23), reused 7 (delta 4)
remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To ssh://git@myserver/home/git/projects/myproject/
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'ssh://git@myserver/home/git/projects/myproject/'

我知道,我不应该从服务器上推,但我需要(我对它不满意)。

我的Git配置文件是这样的:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[branch "master"]
[remote "origin"]
        url = ssh://git@myserver/home/git/projects/myproject/
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master
[receive]
        denyNonFastForwards = True

如果我在服务器上的新位置克隆存储库,问题就会出现。如果我从Windows PC推送到服务器,一切都很好。

有人有任何想法吗?

我已经尝试Git Push Error: insufficient permission for adding an object to repository database已经对问题没有任何影响。

权限设置正确。我几个小时前将数据推送到了repo(从服务器到服务器,从PC到服务器)没有问题。

1 个答案:

答案 0 :(得分:2)

我更改了我的git远程网址,因此没有ssh通过

git remote set-url origin /home/git/projects/myproject/