Initialize GitHub settings under Linux

Source: Internet
Author: User

Generatingssh Keys

westrongly recommend using a SSH connection when interacting with GitHub. Sshkeys is a-identify trusted computers, without involving passwords. Thesteps below would walk you through generating a SSH key and then adding Thepublic key to your GitHub account.

Tip: Werecommend that regularly reviewyour SSH Keys list And revoke any, haven ' tbeen used in a while.

Step 1:check for SSH keys

First , weneed to check for existing SSH keys on your computer. Open up the command line and type:

Ls-al~/.ssh

# liststhe files in your. SSH directory, if they exist

Check Thedirectory Listing to see if you have files named either id_rsa.pub or id_dsa.pub . If Youdon ' t has either of those files, go to Step 2. Otherwise,skip to Step 3.

Step 2:generate a new SSH key

togenerate A new SSH key, copy and paste the text below, making sure Tosubstitute in your email address. The default settings is preferred, so whenyou ' re prompted to "Enter a file in which to save the key", Justpress Enter to continue.

ssh-keygen-t rsa-c " [email protected] "

# Createsa new SSH key using the provided email

#Generating public/private RSA key pair.

# Enterfile in which to save the key (/your_home_path/.ssh/id_rsa):

Next,you ' ll is asked to enter a passphrase.

Tip: westrongly recommend a very good, secure passphrase. For more Information,see workingwith SSH key passphrases.

# enterpassphrase (empty for no passphrase): [Type apassphrase]

# Entersame Passphrase again: [Type passphrase again]

Whichshould give you something like this:

# youridentification have been saved in/ Your_home_path /.ssh/id_rsa.

# Yourpublic Key has been saved in/ Your_home_path /.ssh/id_rsa.pub.

# The Keyfingerprint is:

# 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:[email protected]

Then Addyour new key to the ssh-agent:

# startthe ssh-agent in the background

Eval "$ (ssh-agent-s)"

# Agentpid 59566

Ssh-add~/.ssh/id_rsa

Step 3:add your SSH key to GitHub

openthe ~/.ssh/id_rsa.pub file with a text editor. This isyour SSH key. Select all and copy to your clipboard.

Now Thatyou has the key copied, it's time to add it into GitHub:

1. in the user bar in the Top-rightcorner of any page, click account Settings.

2. Click Sshkeys in the left sidebar.

3. Click Add SSH key.

4. in the Title field, add a descriptivelabel for the new key. For example, if you're using a personal Mac, you mightcall this key "personal MacBook Air".

5. Paste your key into the "key" field.

6. Click Add key.

7. Confirm The action by Enteringyour GitHub password.

Step 4:test everything out

To makesure everything are working, you'll now try Sshing to GitHub. When you do this,you'll be asked to authenticate this action using your password, which wasthe passphrase you created EA Rlier.

Openup the command line and type:

ssh-t [email protected]

# Attemptsto SSH to GitHub

You maysee this warning:

# Theauthenticity of Host ' github.com (207.97.227.239) ' can ' t be established.

# RSA Keyfingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.

# is yousure you want to continue connecting (yes/no)?

Don ' tworry! This was supposed to happen. Verify the fingerprint in your terminalmatches the one we've provided up above, and then type "Yes."

# Hi username ! You ' vesuccessfully authenticated, and GitHub does not

# Provideshell Access.

If Thatusername is yours, you ' ve successfully set up your SSH key! Don ' t worry aboutthe "shell access" thing, you don ' t want that anyway.

If youreceive A message about "Access denied," you can read Theseinstructions for diagnosing the issue .

If You're reswitching from HTTPS to SSH, you'll now have need to update your remote repositoryurls. For more information, see changing aremote ' s URL.

· contact Ahuman

? year GitHub INC. All rights reserved.

· Terms of Service

· Privacy

· Security

Initialize GitHub settings under Linux

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.