Linux下面初始化GitHub设置
2014-09-01 10:27
176 查看
GeneratingSSH Keys
Westrongly recommend using an SSH connection when interacting with GitHub. SSHkeys are a way to identify trusted computers, without involving passwords. Thesteps below will walk you through generating an
SSH key and then adding thepublic key to your GitHub account.
Tip: Werecommend that you regularly reviewyour
SSH keys list and revoke any that 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 have 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 are preferred, so whenyou're prompted to "Enter a file in which to save the key", justpress Enter to
continue.
ssh-keygen-t rsa -C "your_email@example.com"
# 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 be 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 has 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:dbyour_email@example.com
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 have 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 is working, you'll now try SSHing to GitHub. When you do this,you will be asked to authenticate this action using your password, which wasthe passphrase you created earlier.
Openup the command line and type:
ssh -T git@github.com
# 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.
# Are yousure you want to continue connecting (yes/no)?
Don'tworry! This is supposed to happen. Verify that the fingerprint in your terminalmatches the one we've provided up above, and then type "yes."
# Hi username! You'vesuccessfully authenticated, but 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'reswitching from HTTPS to SSH, you'll now 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
Westrongly recommend using an SSH connection when interacting with GitHub. SSHkeys are a way to identify trusted computers, without involving passwords. Thesteps below will walk you through generating an
SSH key and then adding thepublic key to your GitHub account.
Tip: Werecommend that you regularly reviewyour
SSH keys list and revoke any that 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 have 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 are preferred, so whenyou're prompted to "Enter a file in which to save the key", justpress Enter to
continue.
ssh-keygen-t rsa -C "your_email@example.com"
# 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 be 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 has 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:dbyour_email@example.com
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 have 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 is working, you'll now try SSHing to GitHub. When you do this,you will be asked to authenticate this action using your password, which wasthe passphrase you created earlier.
Openup the command line and type:
ssh -T git@github.com
# 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.
# Are yousure you want to continue connecting (yes/no)?
Don'tworry! This is supposed to happen. Verify that the fingerprint in your terminalmatches the one we've provided up above, and then type "yes."
# Hi username! You'vesuccessfully authenticated, but 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'reswitching from HTTPS to SSH, you'll now 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
相关文章推荐
- linux下面的时间设置
- linux下面字体设置的一些资料信息
- linux 下面使用github完整步骤
- 【github】2015.09.09 linux 命令行设置代理,连接github(Linux command line set http proxy for connecting github)
- 需求:过滤下面这个网页里共723行 校对中里 行数为两位数的 行 并设置sz和rz在Windows和Linux之间发送和接收文件不用搭FTP
- Linux下面的时间设置
- Linux 下面设置JavaCLASSPATH变量
- linux (android) video显示分辨率的初始化设置及解析过程
- github 坑爹的仓库初始化设置
- 工具-github在linux下面没有git push报错
- linux下面的时间设置
- Linux环境下面ActiveMQ端口号设置和WEB端口号设置
- linux和windows下面虚拟机的网络设置
- github 坑爹的仓库初始化设置
- linux下面如何设置SSH服务开机启动?
- linux下面的时间设置
- linux下面的时间设置
- Linux web服务器初始化设置
- Linux上电初始化--BOSI启动和boot环境设置
- 关于Linux下面msyql安装后并未设置初始密码,但是登录报错“Access denied for user 'root'@'localhost' (using password: NO)”的解决方案