Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to initiate git on my remote server using ssh. When I run

git init

On the server in a folder I have write permissions to I get the following error.

.git: Permission denied

Do I need to assign any other permissions on that folder to be able to create the repository?

Thanks

share|improve this question
add comment

migrated from stackoverflow.com Apr 20 '10 at 3:56

This question came from our site for professional and enthusiast programmers.

3 Answers

You need rwx rights for the directory you're running git init in. Check also that there is no .git directory already existing in that directory (ls -la) and that there are suitable permissions (if you're initializing, then just remove that directory).

Alternatively check the $HOME/.git directory permissions for being funky, but there shouldn't be anything special there.

share|improve this answer
1  
thanks, it pointed me in the right direction. more specifically the problem was the folder was owned by another user who had the correct perms and my user had write access but not the perms u suggested. Changing the user to my user gave me the perms u suggest! thanks! –  Gcoop Apr 19 '10 at 9:57
add comment
  1. Check that the .git folder doesn't already exist.

  2. To make sure you really have the correct permissions, note down the current permissions and then do a chmod a+wx .. If it works afterwards, remove permissions until it breaks.

share|improve this answer
add comment

SUDO


  • sudo chmod -R 777 /home/.git

  • cd /home/.git

  • Now try Executing the git command

As long as you are on linux, do NOT forget sudo (your best friend)

GoodLUCK!!

share|improve this answer
1  
777 is not a really good idea, a fix maybe but not a good idea in general –  OliverS Apr 20 '10 at 9:38
    
Works on Windows in Git bash shell. I think it is okay to 777 on the .git directory itself if you are going to delete it, because it will no longer exist. –  Travis Pessetto Jun 6 '12 at 18:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.