最近我一直遇到这个错误信息,但我不理解如何正确解决或进行调试。我已经在各种形式的搜索引擎上搜索过这个错误,但没有找到真正的解决方案。我认为这可能与权限有关,但我不知道如何检查或应该检查什么。
我的服务器运行着 Ubuntu 11.10,我正在尝试从我的开发机器向 Git 仓库做初始提交。我使用 root 权限运行。我是否应该以普通用户身份运行?
在服务器上创建仓库:
$ cd /home/username/git
$ mkdir myrepo.git
$ cd myrepo.git/
$ git --bare init
在开发机上创建代码仓库:
Goto rails project directory first
$ git init
$ git add .
$ git commit -m "initial commit"
$ bundle pack
$ git add Gemfile.lock vendor/cache
$ git commit -m "bundle gems"
$ git remote add origin ssh://username@server.com/home/username/git/myrepo.git
$ git push origin master
错误:
fatal: Unable to create temporary file '/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX': Permission denied
error: pack-objects died of signal 13
error: failed to push some refs to 'ssh://username@server.com/home/username/git/myrepo.git'
我的 .git/config 文件:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = ssh://username@server.com/home/username/git/myrepo.git
fetch = +refs/heads/*:refs/remotes/origin/*
类似问题: 如何使用Git进行初始推送到远程仓库?
/etc/group
中列出。将用户添加到组中:https://superuser.com/a/95976/636934。将文件夹的所有者更改为该组(`chown`),并更改文件夹的权限(`chmod`)。 - Brian D