Install git in ubuntu and use the git server provided by CSDN to manage the project code.

Source: Internet
Author: User
Tags git client

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







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.