GIt -- Window下配置 git

全局配置

  1.  git config --global user.name "账户名"
  2.  git config --global use r.email '账户邮箱'
  3. 生成ssh,命令: ssh-keygen -t rsa 

但是在window终端上ssh命令不能用,只能在Git安装目录下的打开git-bash.exe操作,步骤如下:

Git安装目录下,

找到 git-bash.exe

 输入:ssh-keygen -t rsa -C "email@xx.com"

Administrator /
$ ssh-keygen -t rsa -C "email@xx.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):  这里需要你输入一个密码(默认直接输入id_rsa文件名,或是直接回车),到会连接github需要用到

Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Passphrases do not match. Try again.
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.

然后到你的GIthub上创建ssh

 

然后再git-bush.exe,上输入以下命令:

# ssh git@github.com

然后 ,会出现 Enter passphrase for key '/c/Users/Administrator/.ssh/id_rsa':

叫你输入刚才生成sshkey 时,你输入的那个密码(我的是填id_rsa

出现以下情况,表示连接成功。

 

posted @ 2018-01-28 15:47  洪先森  阅读(289)  评论(0编辑  收藏  举报