git SSH secret key

Source: Internet
Author: User

First we need to create SSH key, how to create SSH key?? Go to the directory where our local version is located, execute the following statement: "Ssh-keygen-t rsa-c" registers a GitHub mailbox, and then generates the following files in the user's home directory: (note that the. SSH folder is also generated)

The Id_rsa here is our private key, and Id_rsa.pub is the public key. After creating SSH key, log in to your GitHub account, have a "setting" button in the top right corner, then click on the "Setting" button, then click on the right Menu "SSH" button.

The key of the fourth step here is the content of the Id_rsa.pub file that was generated in the ". SSH" folder, and then click the Add Key button to generate SSH key, such as:

With SSH key, we can associate the local repository with the remote repository and create a new remote repository first:

After you click Add Repository, you are ready to add a remote repository.

Then we associate our local repositories with the remote repositories. Enter the root directory where the local git repository is located, and type the following command: "Git remote add origin [email Protected]:mockingbirds/gitlearn.git", Note that the mockingbirds here is my username for GitHub, Gitlearn.git is the name of the remote repository, and we need to change all of them to be the same as yourself.

Note that we need to commit the local file to the local repository first, that is, the modified file git add filename and git commit need to be linked to the remote repository first. As follows:

This completes the local warehouse and Remote Warehouse Association, I hope you can enjoy.

If prompt error message: Fatal:remote origin already exists.

The solution is as follows:

1. First enter GIT remote RM origin

2, then enter the GIT remote add Origin [email protected]:d jqiang/gitdemo.git will not error!

3. If you enter GIT remote RM origin or an error, error:could not remove config section ' Remote.origin '. We need to modify the contents of the Gitconfig file

4. Find your GitHub installation path, mine is C:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\ etc

5, find a file named Gitconfig, open it to the inside of the [remote "origin"]那一行 delete it!

git SSH secret key

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.