Project

General

Profile

redmine read git repo without having to reset

Added by Kevin Vasko almost 14 years ago

http://www.redmine.org/wiki/1/RedmineRepositories

I currently host the git repos on the same machine as I am hosting redmine. I figured I could simply point the SCM to the (original) .git bare directory on the server (e.g. /home/git/repositories/blah.git) and have it work correctly. The problem I ran into was after someone pushed something to the repo that redmine is looking at (which is the main repository)I would get the following:

The entry or revision was not found in the repository.

fatal: Failed to resolve HEAD as a valid ref.
fatal: bad default revision 'HEAD'
fatal: Not a valid object name HEAD:

Reading the documentation, I would need to duplicate the repository and have it do a post-receive fetch and reset on the main repository to make it work correctly (still don't know how you would do a reset on a bare repo). Am I reading this correctly or is there a better solution to this?

I personally don't really care to duplicate the same exact repo on my box is my original problem to this method. Anyone else have any better suggestions?


Replies (11)

RE: redmine read git repo without having to reset - Added by Felix Schäfer almost 14 years ago

How was the push done to the git repository?

RE: redmine read git repo without having to reset - Added by Kevin Vasko almost 14 years ago

the push was done on my PC to the server hosting the bare git repository. This server also has the redmine installation on it.

RE: redmine read git repo without having to reset - Added by Felix Schäfer almost 14 years ago

No, I meant the protocol. I seem to remember that there were some problems with webdav git repositories not getting the HEAD updated correctly. If you didn't push over http, make sure the user you are pushing as has write rights on all files in the repo.

RE: redmine read git repo without having to reset - Added by Felix Schäfer almost 14 years ago

Ah, speaking of permissions: the user redmine runs as has read permission on the repo, right?

RE: redmine read git repo without having to reset - Added by Kevin Vasko almost 14 years ago

I am pushing over ssh.

I am using gitolite to manage the repos, if that matters.

When I initially created the repo I gave it 777 permissions just for testing purposes. After I pushed it stopped working...but we might be on to something...after I chmoded the repo again (after the push, which would break redmine) to 777 it started working...so it looks to be that git is deleting files and recreating them with the wrong permissions. But it looks like you got me headed in the correct direction.

RE: redmine read git repo without having to reset - Added by Felix Schäfer almost 14 years ago

Make sure whatever you are serving redmine as is in the same group as the gitosis user or something like that. There might also be an option in gitosis to specify a umask or something.

RE: redmine read git repo without having to reset - Added by Kevin Vasko almost 14 years ago

Well I figured out that it does have read access to the /home/git/repository/example.git directory (755) but what is redmine trying to write to in the repository?

As soon as a add write permissions it works. When I take away write permissions it doesn't work after a push.

RE: redmine read git repo without having to reset - Added by Kevin Vasko almost 14 years ago

Kevin Vasko wrote:

Well I figured out that it does have read access to the /home/git/repository/example.git directory (755) but what is redmine trying to write to in the repository?

As soon as a add write permissions it works. When I take away write permissions it doesn't work after a push.

I apologize, I am completely incorrect. I did a little more digging and found out that the refs/master file is being changed to 600 every time I push. This causes redmine not be able to read the refs/master file and causes the error.

Now to figure why the file is being created with 600 every time I push.

RE: redmine read git repo without having to reset - Added by Victor Castell over 13 years ago

Same problem here. To workaround this just run redmine with the same user as gitolite user.

RE: redmine read git repo without having to reset - Added by Kevin Vasko almost 13 years ago

the best solution I found for this was to edit the .gitolite.rc file and to change the umask.

  1. the default umask for repositories is 0077; change this if you run stuff
  2. like gitweb and find it can't read the repos. Please note the syntax; the
  3. leading 0 is required

#$REPO_UMASK = 0077; # gets you 'rwx------'
#$REPO_UMASK = 0027; # gets you 'rwxr-x---'
$REPO_UMASK = 0022; # gets you 'rwxr-xr-x'

RE: redmine read git repo without having to reset - Added by Edipo da Silva almost 10 years ago

I registered just to thank you. You saved me with that, I would never have thought that the problem was gitolite umask

    (1-11/11)