I'm getting the following when I try to send a dir from my server to a private repos with github..
$:/home/my_site/$ git push origin master
Enter passphrase for key '/home/adamgamb/.ssh/id_rsa':
error: unable to create directory for .git/refs/remotes/origin/master
error: Cannot lock the ref 'refs/remotes/origin/master'.
Everything up-to-date
Cur开发者_StackOverflow中文版rently, if I try to use git with out sudo I get this error because the files can't be accessed, however, if I use sudo the git publickey
is rejected (it is in the ~/.ssh of the user im executing this as)
Can anyone explain how to avoid this problem?
$: sudo git push origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
The directory that it's complaining about not being able to create is actually in your home directory -- i.e., ~/.git/refs/remotes/origin/master . Probably what happened is that you ran git under sudo, created these files as root, and now you can't access them. As root, you could chown -R adamgamb ~adamgamb/.git, then try again as you.
精彩评论