我一直在处理此错误消息,我不明白修复它或着手调试它的正确解决方案。我用谷歌搜索了各种形式的错误,但没有真正的解决方案出现。我假设这是权限问题,但我真的不知道如何检查或我应该检查什么。
我有一台运行 Ubuntu 11.10 的服务器,我基本上是在尝试从我的开发机器对我的 git 存储库进行初始提交。我以 root 身份运行。我应该以用户身份运行吗?
在服务器上创建 repo :
$ cd /home/username/git
$ mkdir myrepo.git
$ cd myrepo.git/
$ git --bare init
在开发机器上创建 repo :
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/*
类似问题: How do I do an initial push to a remote repository with Git?
最佳答案
听起来您在 root 拥有的 git 存储库中有文件。由于您以“用户名”身份通过 ssh 进行推送,因此文件必须可由用户名写入。最简单的事情可能是以用户身份创建 repo 协议(protocol),并使用同一用户进行推送。另一种选择是创建一个组,使组中的所有内容都可写,并使您的用户成为该组的成员。
关于git - 致命的 : Unable to create temporary file '/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX' : Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13146992/