Sharing over ssh is similar to sharing it over a filesystem.
Preparing the repository
# On the SSH server we assume /srv/git as the central repository place and will create a new project-X dir $ cd /srv/git $ mkdir project-X $ cd project-X # now we initialize this directory # but instead of using git init, we use git --bare init $ git --bare init
Pushing your local repository to the shared repository
# First go to your local repository $ cd $HOME/project-X # create local git $ git init # Then make the link to the shared repository $ git remote add origin ssh://user@gitserver/var/git/project-X # We push to the remote repository $ git push origin master
Controlling access
To have access, all users must have an account on the ssh server. So that means user-add for each user.
Permissions are handled by filesystem permissions. You could create two groups: project-X-read, project-X-write.
To set these different group permissions you could use:
- Using extended permissions on Linux with setfacl - http://articles.techrepublic.com.com/5100-10878_11-6091748.html
- Extended permissions on MacOSX - chmod +a Groking Darwin ACLs - http://www.afp548.com/article.php?story=20050506085817850
Accessing the repository
# Another user can now clone the repository using: $ git clone file:///share/git/project-X # Change something $ .... # Commit the changes $ git commit -a # Push the changes to the central repository $ git push
Keine Kommentare:
Kommentar veröffentlichen