致命:无法创建临时文件'/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX':权限被拒绝 [英] fatal: Unable to create temporary file '/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX': Permission denied

查看:3131
本文介绍了致命:无法创建临时文件'/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX':权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直有这个错误信息的麻烦,我不明白正确的解决方案来解决它或去调试它。我以各种形式搜索错误,但没有真正的解决方案出现。我假设这是一个权限问题,但我真的不知道如何检查或我应该检查什么。

I have been having trouble with this error message and I don't understand the proper solution to fix it or go about debugging it. I have googled the error in various forms but no real solution has presented itself. I am assuming it's an issue with permissions but I don't really know how to check or what I should check for.

我有一台运行Ubuntu 11.10的服务器, m基本上试图从我的开发机器上初始提交给我的git repo。我以root身份运行。我应该以用户身份运行吗?

I have a server running Ubuntu 11.10 and I'm basically trying to make the initial commit to my git repo from my development machine. I'm running as root. Should I be running as the user?

在服务器上重新创建:

Repo creation on server:

$ cd /home/username/git
$ mkdir myrepo.git
$ cd myrepo.git/
$ git --bare init

在开发机器上重新创建:

Repo creation on development machine:

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

错误:

Error:

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文件

My .git/config file:

[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初始化推送到远程仓库?

推荐答案

听起来好像你拥有root权限的git仓库中的文件。由于您以'用户名'ssh'ing进行推送,因此文件必须可以通过用户名进行写入。最简单的事情可能是以用户的身份创建回购站,并使用相同的用户来完成您的推送。另一种选择是创建一个组,让所有组都可写,并让您的用户成为该组的成员。

It sounds like you have file in the git repo owned by root. Since you're ssh'ing in as 'username' to do the push, the files must be writable by username. The easiest thing is probably to create the repo as the user, and use the same user to do your pushes. Another option is to create a group, make everything writable by the group, and make your user a member of that group.

这篇关于致命:无法创建临时文件'/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX':权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆