3

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?

  • 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. – MangeshBiradar 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. – MangeshBiradar Mar 13 '13 at 14:12
  • I am using "Github for Windows" and had similar issue when switched between two Github accounts. Here's my solution: stackoverflow.com/questions/18565876/… – Alisa Jun 23 '15 at 18:41
11

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.

  • what do you mean by "anonymus push"? – m4l490n Apr 10 at 17:58
  • That's not my phrasing, that's a quote from the man page. Typically, "anonymous" means "without authentication", which follows from the next sentence in that quote: "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)." – larsks Apr 10 at 18:09
  • and why would there be an authentication problem if I can clone the project with my ssh key which proves that I can authenticate just fine. I'm confused. – m4l490n Apr 12 at 5:49
  • @m4l490n I have no idea what you're talking about...I don't believe you're the person who asked the question to which this is the answer, so I have no idea what issue you're experiencing or whether or not this answer applies to your situation. Please feel free to post a new question here and I'm happy to take a look at it. – larsks Apr 12 at 20:35
  • for what is worth, I discovered the issue. I compared the .git/config with another one of my repos that is working fine on the push origin master and it turns out that the one having problems was pointing to an incorrect URL, so problem solved. – m4l490n Apr 15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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