linux - 无法推送 git 存储库

标签 linux git windows-8 window

我正在使用 Windows 8、PuTTY 和 Git 1.8.5.2.msysgit.0。

我有一个在 Debian 服务器上运行的中央 git 存储库。我可以在我的多台 debian 机器之间克隆、推送、 pull 、 merge (做所有事情)没问题。

我可以使用 git clone [user]@[host]:/usr/git/site.git 克隆和 pull git 存储库,这将毫无问题地克隆 git 存储库。

问题是当我尝试将 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 机器推送到中央仓库,它工作正常。

最佳答案

当尝试推送的用户没有对远程服务器中的 git 存储库的写入权限时,就会发生这种情况。您可以这样做:

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

关于linux - 无法推送 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21836334/

相关文章:

git - 默认从 git Commit 中排除 Visual Studio 中的文件

xaml - 如何在 Windows 8 中的 Metro 应用程序中创建菜单项

linux - 如何将 IF ELSE 添加到 linux 变量

linux - 在 linux 中列出除少数文件之外的所有文件

linux - 使用 ps 对进程进行分组

git - git pull 后出现 git merge 问题

git - 如何从 git 中的存储库填充我的空工作树?

windows-8 - 如何将文件拖入在 Windows 8 上以管理员身份运行的 Visual Studio

c++ - XAudio2 延迟声音 - 播放多个声音时

android - 在 Reh Hat Linux 上启用 USB Debug模式