I’m playing around with git as a possible replacement for Subversion (svn). I’ll probably blog about my reasons for wanting to switch and also have some tutorials. For now, I wanted to quickly share the fix for a problem I encountered that wasn’t really handled by the documentation.
I set up a bare remote repository to test git out. Everything looked good as I got this going, but then I hit a big snag.
When I tried to push the local repository back to the remote repository, I received the following error:
Counting objects: 9, done.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 531 bytes, done.
Total 5 (delta 3), reused 0 (delta 0)
*** Project description file hasn’t been set
error: hooks/update exited with error code 1
error: hook declined to update refs/heads/master
To ssh://username@hostname/projectname
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to ‘ssh://username@hostname/~/projectname’
I have to say that this was completely unexpected as I had followed tutorials in the official documentation up to this point. None of the steps said anything about a “project description file” nor about new bare repositories requiring additional setup in order to be pushed to.
Fortunately, this problem wasn’t difficult to fix. There is a file inside the bare repository’s root called description. I simply modified this file and the next time I pushed the changes, it worked like a charm.
If your bare repository is in ~/projects/test.git, you would do the following:
- Modify the description file:
vi ~/projects/test.git/description
- Delete the existing text:
Unnamed repository; edit this file to name it for gitweb.
- Put whatever description you want for the repository in the file:
My Really Awesome Project
- As always, save the file and close vi.
Now you can push without this nasty error hanging you up.
As a side note, the developers of git have a hosted git solution that is really cool. It’s called github, you should check it out.
Wow, that post probably saved me hours, thanks!
I’m glad that it helped you out Kalle.
It helped me too. Thanks.
And another thank you from me
+1 from us! thx.