1. Installing the Git and SSH tools
Apt-get Install Git-core openssh-server openssh-client
2. Add a user named Git
Useradd-m git
passwd git
3. Create a new git repository directory and modify directory permissions
Mkdir/home/gitprojects
Chown git:git/home/gitprojects
chmod 700/home/gitprojects
4. Installing Gitosis
Apt-get Install Python-setuptools
git clone https://github.com/res0nat0r/gitosis.git
CD gitosis
Python setup.py Install
5. Switch to git user, link/home/gitprojects and/home/git/repositories
Su git
Ln-s/home/gitprojects/home/git/repositories
6. Configure Gitosis
Need to generate Sshkey on the client computer and upload id_rsa.pub to a server directory
ssh-keygen–t RSA
SCP xxx/.ssh/id_rsa.pub [Email protected]:/home/id_rsa.pub
7. Modify the Id_rsa.pub permissions on the server and run Gitosis
chmod a+r/tmp/id_rsa.pub
Sudo–h–u git gitosis-init
8. Modify post-update file permissions
sudo chmod 755/home/gitprojects/gitosis-admin.git/hooks/post-update
9. Create a new warehouse on the server lsgame.git
Su git
Cd/home/gitprojects
Git init--bare lsgame.git
10. Configure Gitosis
back to client clone Gitosis-admin.git
git clone [email protected]10.203.148.102: Gitosis-admin.git
Gitosis the Sshkey of the other hosts into the Keydir and configure the gitosis.conf files as needed
Example
[Gitosis]
[Group Gitosis-admin]
Members = [email protected]
writable = Gitosis-admin
[Group Lsgame]
Members = [email protected]
writable = Lsgame
Commit modification Configuration
git Add.
Git commit-am "xx"
Git push Origin Master
11. Client-Submitted code
Git init
git Add.
Git commit-am "initial version"
git remote add origin [email protected]<server>:lsgame.git
Git push Origin Master
Ubuntu git Server Setup