Subgit - first commit works but the second fails

Hello all,

We tried to turn off the mirror but needed to bring it back.
I have resolved the sync issues and restarted the mirror.

However, I can commit once but when I try to commit again I get the error:

You’ve received this message because SubGit (http://subgit.com/) is installed in your repository
remote: and an error that needs to be dealt with has occurred in SubGit translation engine.
remote:
remote: TEMPORARY ERROR:
remote: Failed to push some refs to Subversion repository.
remote: svn: E204899: Can not write to file ‘/mnt/repo/repositories/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git/svn/refs/svn/root/branches/mirrorTest/.rev_map.481305a0-56ca-cd41-b609-55902aca01bb’: /mnt/repo/repositories/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git/svn/refs/svn/root/branches/mirrorTest/.rev_map.481305a0-56ca-cd41-b609-55902aca01bb (Permission denied)
remote: /mnt/repo/repositories/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git/svn/refs/svn/root/branches/mirrorTest/.rev_map.481305a0-56ca-cd41-b609-55902aca01bb (Permission denied)
remote:
remote:
remote: CURRENT STATE:
remote: Both Git and Subversion repository are open for pushes or commits.
remote: Your commit was not committed, but you may retry it.
remote:

The file "/mnt/repo/repositories/repositories/@hashed/ef/2d/ef2d127de37b942baad06145e54b0c619a1f22327b2ebbcfbec78f5564afe39d.git/svn/refs/svn/root/branches/mirrorTest/.rev_map.481305a0-56ca-cd41-b609-55902aca01bb "

was owned by root when I used CHMOD to change it to git (the user the mirror runs as) it worked.

Any idea what is causing this?
Files like this keep being owned by root and blocking commits until I chown them back to git

Hi Steve,

most probably it’s because SubGit daemon runs on behalf of ‘root’ instead of ‘git’. The solution is to stop the daemon but the subgit shutdown command, do chmod against the repository recursively and the start the daemon again on behalf of ‘git’. Another possible reason somebody is pushing over ssh or maybe even over file protocol on behalf of ‘root’, so the file are being created owned by ‘root’. I don’t see any other reasons for that since all the GitLab tasks run on behalf of ‘git’ and if SubGit started as ‘git’ then it creates all the files similarly.

Hi,

I initialised the mirror as the git user.
Would that be sufficient?

If not would I do the following:
subgit shutdown repoName
sudo chown -R git repoName
ensure that I am the git user
subgit initialise gitName

Hi Steve,

it would be sufficient unless there are ways to create files in the repository on behalf of other users – like, for example, a possibility to push over ssh or file protocols. If you start the mirror as git and nobody commits over ssh/file, then it is sufficient; otherwise, some addition actions may be needed.
As for the fix for the this issue – I agree with the steps but the latest one: actually, there is no subgit initialise command, so subgit install should be used. So here are the steps to change owners and restart the mirror:

  • subgit shutdown repoName
  • sudo chown -R git repoName
  • su git (for example)
  • subgit install repoName

The last step start the mirror again.