1, to prepare related software
1.1 Preparation ssh necessary tools
Easy to log into and ssh authentication:
1 $ sudo apt-get install openssh-client 2 $ sudo apt-get install openssh-server
1.2 prepare the necessary tools git
Note that establishing a dedicated user control, such as the back of the two commands:
1 $ sudo apt-get install git git-core 2 $ sudo useradd git 3 $ sudo passwd git
2, create server-side empty warehouse
1 $ mkdir -p gitRepo / project.git create the necessary project folder # 2 $ git --bare the init gitRepo / project.git # initialize blank warehouse
3, the client initiates warehouse and commit code
Project cd $ $ git the init $ git the Add. $ Git the commit -AM " the init at The repo " $ git the Add Remote Origin the User @ ip: / path / to / project.git # Set the remote repository path $ git push origin master # submitted a version of the code;
Note: If the remote library path set in question, can be corrected by git config commands, such as:
1 $ git config remote.origin.url # view the current settings of the path 2 $ git config remote.origin.url the User @ ip: /path/to/project.git # modify the current path for the latter
4, start collaborating
Other users can collaborate through direct git clone of ways, such as:
$ git clone user@ip:/path/to/project.git local_project_name
More Help git git use reference;
Reproduced in: https: //www.cnblogs.com/QuLory/archive/2013/01/21/2869108.html