git学习2:建立账号以及创建密钥

一、建立账号

1.注册

进入www.github.com  注册账号

 

2.验证邮箱

     a. 登录

     b.Account setting  ——emails中验证邮箱

 

二、创建密钥

我们如何让本地git项目与远程的github建立联系呢?之里就用的密钥

参考官方文档: https://help.github.com/articles/generating-ssh-keys

 

Step 1: Check for SSH keys

 

打开安装后的windows版本的git命令方式:Git Bash  

Welcome to Git (version 1.8.4-preview20130916)


Run 'git help git' to display the help index.
Run 'git help ' to display help for specific commands.

Administrator@WSL-PC ~

 

$ cd ~/.ssh

$ ls
id_rsa  id_rsa.pub  known_hosts

 

Step 2: Generate a new SSH key

 

$ ssh-keygen -t rsa -C "[email protected]"         注意C大写
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
/c/Users/Administrator/.ssh/id_rsa already exists.
Overwrite (y/n)? y

Enter passphrase (empty for no passphrase):                   
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
49:41:67:6c:c9:61:1f:6e:0c:8f:9a:b3:68:e6:fe:60 wsl@chan***.com

 

 

注意: 此处的邮箱地址,你可以输入自己的邮箱地址。在回车中会提示你输入一个密码,这个密码会在你提交项目时使用,如果为空的话提交项目时则不用输入。这个设置是防止别人往你的项目里提交内容。

Step 3: Add your SSH key to GitHub

 

打开本地C:\Documents and Settings\Administrator\.ssh\id_rsa.pub文件。此文件里面内容为刚才生成人密钥。

登陆github系统。点击右上角的 Account Settings--->SSH Public keys ---> add another public keys

把你本地生成的密钥复制到里面(key文本框中), 点击 add key ok

 

 

Step 3.测试链接是否成功:

Test everything out

 

$ ssh -t [email protected]
Hi slwang! You've successfully authenticated, but GitHub does not provide shell
access.
Connection to github.com closed.

 

 

 

 

 

 

 

你可能感兴趣的:(github)