首页 > 系统相关 >archlinux连接Github与本地

archlinux连接Github与本地

时间:2023-01-23 21:44:26浏览次数:68  
标签:Github config github archlinux ssh 本地 git com

连接Github与本地

首先右键打开git bash,然后输入下面命令:

git config --global user.name "vconlln"
git config --global user.email "[email protected]"

用户名和邮箱根据你注册github的信息自行修改。

然后生成密钥SSH key:

ssh-keygen -t rsa -C "[email protected]"

打开github,在头像下面点击settings,再点击SSH and GPG keys,新建一个SSH,名字随便。

git bash中输入

cat ~/.ssh/id_rsa.pub

将输出的内容复制到框中,点击确定保存。

输入ssh -T [email protected],如果如下所示,出现你的用户名,那就成功了。

Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.

报错解决:

今天尝试克隆 Github 仓库时遇到了诡异的报措 kex_exchange_identification: Connection closed by remote host 。随即做如下检查:

  • Github 平台与本地的 ssh key 均配置正常
  • 本地 ~/.ssh/config~ 中没有开启 proxy 代理配置
  • 执行命令 ssh -T [email protected] 返回如下结果
$ ssh -T [email protected]

kex_exchange_identification: Connection closed by remote host

原因

家中使用的梯子封禁了 Github 端口 22 的连接

解决

将 Github 的连接端口从 22 改为 443 即可。修改 ~/.ssh/config ,添加如下段落即可

Host github.com
    HostName ssh.github.com
    User git
    Port 443

验证

ssh -T [email protected]
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.

标签:Github,config,github,archlinux,ssh,本地,git,com
From: https://www.cnblogs.com/vconlln/p/17065565.html

相关文章