Chad Johnson
Chad Johnson

Reputation: 21905

Multi-user Mercurial repositories over SSH?

I have a centralized Mercurial repository which I want to provide access to via SSH.

I did a chown root:developers repository -R on the repository directory, so all users in group 'developers' should have access.

So, I clone, add my initial files to the repository as user A, commit, push, done. Now, I go as user B, clone, add a file, commit, and push. But then, when I do a pull, an update, and change that file as user A and then try to push, I get

pushing to /var/hg/repository
searching for changes
1 changesets found
adding changesets
adding manifests
adding file changes
transaction abort!
rollback completed
abort: Permission denied: /var/hg/repository/.hg/store/data/test.i

Am I missing a configuration step? Should I not be using SSH?

EDIT I found that using the sticky bit solves the problem: How to set permissions so two users can work on the same hg repository?. Is this a bad solution?

Upvotes: 6

Views: 1828

Answers (3)

Chad Johnson
Chad Johnson

Reputation: 21905

The Mercurial documentation says using the setgid flag is okay.

Upvotes: 2

Patrice Tisserand
Patrice Tisserand

Reputation: 401

Maybe you could be interested by mercurial-server: http://www.lshift.net/mercurial-server.html

mercurial-server is useful if you don't want to provide a shell to developers on server hosting mercurial central repository.

Upvotes: 2

Ry4an Brase
Ry4an Brase

Reputation: 78350

Sticky group bit is the right way to do this. Also, it used to be the case that user's umasks needed to be set such that group read/write would be on for new files they add, but for the last year or two mercurial copies the permissions (not ownership) of the .hg directory in the repo itself on to newly created files, so the umask isn't as important.

Upvotes: 3

Related Questions