Install git in ubuntu and use the git server provided by CSDN to manage the project code.
1. Install the git Client
Sudo apt-get install git
2. Set the user name and email
Git config -- global user. name "XXXX"
Git config-global user. email "SSSSS@hotmail.com"
3. Initialize an empty project that contains only the empty README. MD file:
Touch README. md
Git init
Git add README. md
Git commit-m "first commit"
Git remote add origin git@code.csdn.net: SSSSS/feathersync. git
Git push-u origin master
4. The above message shows that you do not have the permission, mainly because the public key is not generated.
Ssh-keygen-C 'sssss @ hotmail.com '-t rsa
5. The public key is generated in the following directory by default.
/Home/zhigang/. ssh/id_rsa.pub
6. paste all the public key file content generated above into the public key content of the csdn code project, and set the name casually.
7. Submit all project files for the first time
Git add.
You can use git show to view the project status.
Use git branch-a to view all branches
Use git branch-r to view remote branches
Git commit-m "submit all project files for the first time ."
8. push to the remote Branch
Git push origin master: master
Git pull <Remote Host Name> <remote branch name>: <local branch name>
Origin specifies the remote to which you want to push
If you omit <remote branch name>, git recognizes that you want to push the branch with the same name as local branch under remote repository.
Therefore, it can be abbreviated:
Git push origin master
9. The previous update is rejected,
Git pull <Remote Host Name> <remote branch name>: <local branch name>
Git pull origin master: master
Pulling the master branch of the orgin warehouse to the local master branch can be omitted <local branch name>
Can be abbreviated:
Git pull origin master
During the pull process, you may need to provide comments of pull. After pull is successful, you can use the following command to submit it.
Git push origin master