简体   繁体   English

无法推送git信息库

[英]Cannot push git repository

I am using Windows 8, PuTTY and Git 1.8.5.2.msysgit.0. 我正在使用Windows 8,PuTTY和Git 1.8.5.2.msysgit.0。

I have a central git repository running on a Debian server. 我有一个在Debian服务器上运行的中央git仓库。 I can clone, push, pull, merge (do everything) between my multiple debian machines no problem. 我可以在多台debian机器之间克隆,推送,拉取,合并(执行所有操作)没有问题。

I can clone and pull the git repo using git clone [user]@[host]:/usr/git/site.git and this will clone the git repo no problem. 我可以使用git clone [user]@[host]:/usr/git/site.git克隆并拉出git repo,这将克隆git repo没问题。

The problem is when I try and push the changes on git to the central repo, I get this error: 问题是当我尝试将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

I cannot figure out what is wrong, because it works fine if I push from another linux machine to the central repo. 我无法弄清楚出什么问题了,因为如果我从另一台linux机器推送到中央存储库,它将很好地工作。

This happens when the user that tries to push does not have write access to the git repo in the remote server. 当尝试推送的用户对远程服务器中的git repo没有写访问权时,就会发生这种情况。 You can this as follows: 您可以如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM