无法推送git仓库

时间:2014-02-17 18:12:03

标签: linux git windows-8 window

我使用的是Windows 8,PuTTY和Git 1.8.5.2.msysgit.0。

我有一个在Debian服务器上运行的中央git存储库。我可以在我的多个debian机器之间克隆,推送,拉动,合并(做一切)没问题。

我可以使用git clone [user]@[host]:/usr/git/site.git克隆并拉出git repo,这将克隆git repo没问题。

问题是当我尝试将git上的更改推送到中央存储库时,我收到此错误:

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

error: insufficient permission for adding an object to repository database ./objects

fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To [user]@[host]:/usr/git/site.git
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to '[user]@[host]:/usr/git/site.git

我无法弄清楚出了什么问题,因为如果我从另一台Linux机器推送到中央仓库,它可以正常工作。

1 个答案:

答案 0 :(得分:1)

当尝试推送的用户没有对远程服务器中的git仓库的写访问权时,会发生这种情况。你可以这样做:

$ ssh me@myserver
$ cd repository.git
$ sudo chmod -R g+ws *
$ sudo chgrp -R mygroup *
$ git config core.sharedRepository true