shared git repo + ssh = umask problems

Posted by on December 19, 2008

When you want to share a little git repository on your own server the first thing that comes to your mind is SSH. It’s installed virtually everywhere, secure and easy to configure.
In the beginning there are no problems, because everyone can clone your repo and if they don’t change files concurrently even pushing works. About one day latter you get umask problems and start to search the web for solutions. To make it short, here it is:

git repo-config core.sharedRepository true

This option makes git care about the permission stuff.
I wasted about 10 hours of my lifetime for this one and found an odd thing about ~/.ssh/rc:

umask 002
date > ~/sshrc-executed

I added the second line, because I wasn’t sure if it was executed. It was (look at the file permissions):

...
-rw-rw-r--  1 moser git     29 Dec 19 18:41 sshrc-executed

But my umask didn’t last:

moser@HellAgent:~$ ssh xxx.net -n 'umask'
Password: 
0022

Don’t know why, if anyone knows tell me please.

Comments

Respond | Trackback

  1. xurde February 19, 2009 2:57 am

    Thanks for avoiding me wasting 10 hours more. :)

    Best

  2. Gitter February 22, 2009 1:14 pm

    Another 10 hours here.
    Thanks.

  3. codonnell February 23, 2009 6:51 pm

    i believe sshd executes ~/.ssh/rc in a subshell. umask only affects the current process and its children, it does not propagate back up to the parent process. hence the fact that your test file was created with desired permissions but the umask did not stay in effect.

    to the best of my knowledge, the default ssh umask is set based on your login class. other than changing it there, you can look for workarounds for non-interactive ssh logins. i don’t know how restrictive sshd is in this regard.

    hth. good luck.

  4. [...] a lot to Moser for pointing out the git repo-config core.sharedRepository true option. I’ve also had a bit more of a look around git config (because repo-config is an alias [...]

  5. [...] idea que l’umask serà el teu amic … però al final cerques una mica per Internet i et trobes amb una solució molt més [...]

Comments

Comments: