If you are in a trusted environment, or you already have an alternative access/authorization mechanism in place, using SSH keys for git is sometimes an annoyance. Turns out you can easily get rid of that, although you should only do that if you are 100% sure what you are doing.

WARNING The following will make your git repository public and anybody will be able to write to it

$ touch .git/git-daemon-export-ok
$ git config daemon.receivepack true

If you receive the following error:

$ git push origin master
Counting objects: 5, done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 323 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
error: unpack failed: unpacker exited with error code
To git://server/git/test.git
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to ‘git://server/git/test.git’

Make sure your repository is owned by the user running git-daemon on the server.

2 Thoughts on “Set up a public write-access git repository

  1. Thanks a lot man! I was looking for a simple way to make my Git repo’s publicly available. I know it’s a ‘security risk’.

    But I wasn’t able to ‘git push origin master’ my local Git working changes back to my git://servername.com/git-repo-name on my MacMini.

    This ‘git config daemon.receivepack true’ thing was the final piece that made it work. Thanks man.

  2. The downside of the Git protocol is the lack of authentication.

    So WRITE access = RISK!

    Generally, you’ll pair it with SSh or HTTPS access for the few developers who have push (write) access and have everyone else use git:// for read-only access.

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post Navigation