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 have created a test git repo on Git server:

/var/cache/git/username/myGitRepo.git

Which is a 'bare' git repo. The ownership of the files belong to this 'username' user. I can clone the above Git repo, on another Windows machine.

git clone git://myhost/var/cache/git/username/myGitRepo.git

The repo clones correctly. Then I can do local commits and try to push the changes back to my Git server:

git push origin master

But that gives a permission error on the server:

fatal: remote error: access denied or repository not exported: /git/username/myGitRepo.git

I added the magic file 'git-daemon-export-ok' file in the repo dir. But I keep getting the above error.

I even set the chmod to 777 of the /var/cache/git/username/myGitRepo.git

Getting same error.

Git remote -v throwing following output.

$ git remote -v
origin  git://myhost/git/username/myGitRepo.git (fetch)
origin  git://myhost/git/username/myGitRepo.git (push)

Anyone could help me to get this error resolved?

share|improve this question
    
Can you show us the result of git remote -v run in your working copy? Are there any options associated with the ssh key installed in username's authorized_keys file? –  larsks Mar 13 '13 at 13:21
    
Thanks for the attention....I updated the question accordingly. –  meMangesh Mar 13 '13 at 13:49
    
You say that you cloned from ssh://myhost/var/cache/git/username/myGitRepo.git but the output of git remote -v clearly shows git:// URLs, which are typically read-only. Would you please repeat the clone operation exactly as you present it in this question, re-run git remote -v, and see what the URLs look like? –  larsks Mar 13 '13 at 13:55
    
I apologies for typo..I am using the git protocol to clone. –  meMangesh Mar 13 '13 at 14:12

1 Answer 1

up vote 4 down vote accepted

Out of the box, the standard git-daemon does not allow you to push into repositories. The man page says:

This is ideally suited for read-only updates, i.e., pulling from git repositories.

If you really want to enable anonymous push (and really, you don't; just use ssh), you need to enable the receive-pack service, which is disabled by default (because it's a bad idea). Again, from the man page (the SERVICES section):

receive-pack

This serves git send-pack clients, allowing anonymous push. It is disabled by default, as there is no authentication in protocol (in other words, anybody can push anything into the repository, including removal of refs).

The bold is mine. You can enable this service globally by passing the --enable=receive-pack command line option, or per-repository by setting daemon.receivepack to true in your repository's git configuration.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.