Git Server Configuration:
1. Install git: sudo apt-Get install Git-core
2. Install the SSH service: sudo apt-Get install OpenSSH-Server
3. Create a server repository folder (which can be accessed by the user root): mkdir/Project. Git
4. Create a blank Repository: git -- bare init/Project. Git
Configuration details
1. Create a local repository
mkdir -p StudyGitcd ./StudyGitvim ReadMe.mdvim FirstActivity.java
Create a local repository for the studygit project, go to the root directory of the studygit project, and perform the following operations under the root directory:
Git init // at this time, only some initial work is performed according to the directory structure of the studygit project. The file of the studygit project has not been finally submitted to the local repository.
Submit the files in the studygit project to the local repository:
Git add src/git add readme. MD // convert the files in the src directory to readme. add the MD file to the temporary storage zone git commit-a-m "" // at this time, studygit project records are saved in the local repository, next, you can push the content in the local repository to the remote repository.
Add a remote repository for the studygit project and push the code in the Local repository to the remote Repository:
Go to the root directory of studygit and add a remote repository for this project (note that you must enter the directory of the studygit project, not necessarily the root directory. Sub-directories can also be used ):
Git remote add OSC [email protected]: XX/studygit. git // 1. "OSC" is the alias of the remote warehouse address (not the name of the item on the remote warehouse). The default value is origin. 2. [email protected]: XX/studygit. git pay attention to the "Flan" following the colon, which is the path allocated by OSC for each account. My remote repository path is serverip/XX/studygit. git, so the colon is followed by XX. Note the changes for different accounts;
View the added remote Repository:
git remote -v
Push the local repository to the remote repository on [email protected:
Git push OSC master // "OSC" is the name of the created remote warehouse, and "master" is the main branch of the Local warehouse (currently only this branch exists, no other Branch)
For more information about git commands, see the http://git.oschina.net/progit/.
Git-distributed version control system (Distributed VCs ):