Search code examples
gitunixpermissionsgit-clone

Cloning a repo from my home directory


I recently git-ified a web project. Following this guide, I set up a bare repo in my home directory /home/mt33 that acts as the hub for the clone sitting in www/. Then I cloned the bare repo (no working tree) to my local machine, make my changes, commit, and push origin master them to the server. The post-update script on the bare repo then takes care to cd to the www/ clone, and pull all changes. This all works great.

I want to add a second developer, but he is unable to clone from the bare repo sitting in my home directory. So I asked the sysadmin to add group-read, group-write and group-execute permissions to my home directory and add the second dev to my group. Consequently, he confirmed that he can SSH to the server and cd into home directory, as well as see the contents of the repo.git directory. Here's what he sees:

drwxrwxr-x 7 mt33 mt33 4096 2012-03-07 19:10 repo.git

When he tries to clone using

git clone theseconddev@theserver:/home/mt33/repo.git my_directory he gets the error

fatal: '/home/mt33/repo.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly

At this point I'm not sure what to do... Is the bare repo in my home directory a problem? Any pointers appreciated...


Solution

  • You may need to also add those permissions for the files within /home/mt33/repo.git.

    chmod -R g+rwx /home/mt33/repo.git
    

    (Also make sure to set sharedRepository=true inside the config file to properly preserve the permissions in the future.)