使用git连接到Github

直奔主题,使用git连接到Github步骤如下:

1. 安装git

yum install git

或者

sudo get-apt install git git-core

2. 全局配置

git config --global user.name "furzoom"
git config --global user.email "mn@furzoom.com"

3. 生成密钥

ssh-keygen -t rsa -C "mn@furzoom.com"

有任何提示,直接回车即可。

4. 将公钥提交到Github

复制文件~/.ssh/id_rsa.pub中的内容到Github中。

vim ~/.ssh/id_rsa_pub

复制文件中的内容,打开https://github.com/settings/ssh,并点击Add SSH key,将内容粘贴到Key中。

5. 测试连接状态

$ ssh git@github.com
The authenticity of host 'github.com (192.30.252.129)' can't be established.
RSA key fingerprint is XXXXXXXXX.
Are you sure you want to continue connecting (yes/no)? yes 
Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.
PTY allocation request failed on channel 0
Hi Furzoom! You've successfully authenticated, but GitHub does not provide shell access.
                                                                                        Connection to github.com closed.
$ 

出现类似如下上信息表示连接成功了。剩下的操作就是正常的git操作了。

更多请参考枫竹梦

原文地址:https://www.cnblogs.com/furzoom/p/7710278.html