Git common commands 2

Source: Internet
Author: User

Git common command 2 Add remote repositories (take GitHub for example)

Login to the official website https://github.com, if not, go to register an account.

Then create a new warehouse

In the repository name fill in learngit , the other remains the default settings, click the "Create Repository" button, the successful creation of a new Git repository:

At the moment, this warehouse on GitHub learngit is still empty, and GitHub tells us that we can clone a new repository from this repository, or associate an existing local repository with it, and then push the contents of the local repository to the GitHub repository.

The authentication connection for the remote repository is also required before this

As the following steps:

Running commands on the server

" [email protected] "

You need to change the email address to your own email address, and then return to the default value, as this key is not used for military purposes, so there is no need to set a password.

If all goes well, you can find the directory in the user's home directory .ssh , there are id_rsa and id_rsa.pub two files, these two are SSH key key pair, is the private key, can id_rsa not be leaked out, id_rsa.pub is the public key, it is safe to tell anyone.

2nd step: Login to GitHub, open "Account Settings", "SSH Keys" page:

Then, click "Add SSH Key", fill in any title, paste the contents of the file in the Key text box id_rsa.pub :

Click "Add Key" and you should see the Key already added:

Why does GitHub need SSH key? Because GitHub needs to recognize that your push submission is actually pushed by you, not someone else impersonating it, and Git supports the SSH protocol, so if GitHub knows your public key, you can confirm that only you can push it.

Of course, GitHub allows you to add multiple keys. Assuming you have a number of computers, you can submit them at the company in a moment, and at home, just add each key to GitHub and push it to GitHub on every computer.

--------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------

Git common commands 2

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.