fatal: Unable to create temporary file '/home/username/git/myrepo.git/./objects/pack/tmp_pack_XXXXXX': Permission denied

前端 未结 8 986
独厮守ぢ
独厮守ぢ 2020-12-23 09:00

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

相关标签:
8条回答
  • 2020-12-23 09:32

    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.

    0 讨论(0)
  • 2020-12-23 09:32

    Just try to do this one (through root access) - "chmod -R 777 /home/username/git"

    0 讨论(0)
  • 2020-12-23 09:43

    It would seem like your user doesn't have permission to write to that directory on the server. Please make sure that the permissions are correct. The user will need write permissions on that directory.

    0 讨论(0)
  • 2020-12-23 09:45

    A possibility is that the git server you are pushing to is down/crashed, and the solution lies in restarting the git server.

    0 讨论(0)
  • 2020-12-23 09:46

    Thanks to Don Branson,I solve my problem.I think next time i should use this code when i build my repo on server:

    root@localhost:~#mkdir foldername
    root@localhost:~#cd foldername
    root@localhost:~#git init --bare
    root@localhost:~#cd ../
    root@localhost:~#chown -R usergroup:username foldername
    

    And on client,i user this

    $ git remote add origin git@servername:/var/git/foldername
    $ git push origin master
    
    0 讨论(0)
  • 2020-12-23 09:50

    One of the principal issues with pushing to a GIT is that the material you push will appear as your material, and will block submissions from other people on a team. As a GIT repository administrator, you will have to manage the hooks to prevent Alice's push from blocking Bob from pushing. To do that, you will want to ensure that your developers all belong to a group, lets call it 'developers' and that the repository is owned by root:developers, and then add this to the hooks/post-update script:

    sudo chown -R root:developers $GIT_DIR
    sudo chmod -R g+w $GIT_DIR
    

    That will make it so that team members are able to push to the repository without stepping on each other's toes.

    0 讨论(0)
提交回复
热议问题