Git ssh
You can host your git repos on your own servers using SSH.
Setup
Create Repo
On the remote server that you wish to store repo, create it.
cd /path/projectname git init --bareOn your computer, create an empty repo, and push to remote server
git remote add origin ssh://git@gitbox:8610/home/git/my_project git --set-upstream origin --all git pushClone Repo
From this point onwards, you can clone the repo like this:
git clone ssh://user@10.10.10.10:/path/to/repoYou can also shorten it with an ssh config
# ~/.ssh/config Host myhost Hostname 10.10.10.10 IdentityFile ~/.ssh/mykey User usergit clone ssh://myhost:/path/to/repo # you can also change the SSH command used GIT_SSH_COMMAND="ssh -i ~/.ssh/foo" git clone ssh://myhost:/path/to/repo # you can also specify it in the git config, but you'll need to configure it for each clone
Configuration
Git Shell
If you'd like to restrict this user's SSH access to git operations,
you can configure it's shell to begit-shell
(included with git).For example
adduser foo chsh foo /usr/local/libexec/git-core/git-shellGit shell can further restrict which commands a user can perform over SSH,
Which you can use to configure (for example) authenticated, read-only access to a repo.Read-Only Access
You can setup read-only access, by creating users and changing user/file permissions.
The safest route is probably creating a separate unix group for each repo,
then you can manage repo access by adding unix users to groups.