1.https://github.com/ 注册,略...
2.创建一个新的工程
3.下载git客户端,选择git安装目录,略...
下载地址:https://git-for-windows.github.io/
4.生成秘钥
ssh-keygen -t rsa -C "your@email.com"
成功如下:
5.进入到安装目录下,查看生成的秘钥
6.登录github.com配置秘钥
ssh git@github.com
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
PTY allocation request failed on channel 0
Hi xxxuser! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
Administrator@USER-20160524DB MINGW64 ~/Desktop
出现上面所示:
①
Warning: Permanently added the RSA host key for IP address '192.30.255.113' to the list of known hosts.
解决:在hosts文件夹下添加如下:
192.30.255.113 github.com
②
The authenticity of host 'github.com (13.229.188.59)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)?
解决:查看ssy是否存在:$ ls -al ~/.ssh
重新生成和配置sshkey第4步和第五步
正常显示如下:
$ ssh git@github.com //正常情况下,回显如下 PTY allocation request failed on channel 0 Hi plinx! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.
7.配置github远程仓库
如果是第一次配置github远程仓库,需要设置用户名和邮箱,并添加远程地址,给远程仓库起个别名
git config --global user.name "github用户名" git config --global user.email "your_github_email@qq.com" git remote add origin( origin:别名) git@github.com:yourName/yourRepo.git