0

I want to setup git repository on my server so it is accessible from my webserver (read and write with redmine). I want to be able to create repository with my user (toto) in SSH.

Currently I set up the following:

  • I have created a /var/redmine/repositories (owned by toto)
  • I create repo in this folder and then change ownership to www-data

Currently the repositories are github clone but I would like in the future host my own repositories on the server.

In this context I plan to use a proper git user and include www-data user in git group.

Does it seems correct?

1 Answer 1

0

So, I guess you will be using your git user to create the repositories, instead of toto?

You may be facing a problem if you choose this path, depending on your umask. Try issuing this commands:

git@host$ mkdir tata.git git@host$ ls -ld tata 

If your umask is 002, this will show this:

drwxrwxr-x 2 git git 4096 Nov 11 13:50 tata.git 

And this is fine. However, if your umask is 022 - which is the case in most distributions, then you will get this:

drwxr-xr-x 2 git git 4096 Nov 11 13:50 tata.git 

You see that here, the members of group git only have r-x permission on the folder - no write permissions at all. So even if you make www-data part of group git, the webserver won't have write permissions on that repository.

The solution, as stated in the above link, is to set your umask to 002 in the appropriate file, which in most cases, will be your /home/git/.profile, like this:

umask 002 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.