mac电脑git配置sshKey后不能下拉代码

配置全局
git config --global user.name 用户名 git config --global user.email 邮箱 git config --list //查看配置的用户 ssh-keygen -t rsa -C 248******@qq.com // 输入邮箱,一直回车(遇到y/n,选y) ls -al ~/.ssh // 查看是否生成了私钥,公钥(id_rsa是私钥 id_rsa.pub是公钥) cat /Users/mc/.ssh/id_rsa.pub // 查看公钥,复制全部,打开GitHub create一个ssh,复制进去 ssh -T git@github.com // 出现Hi***,成功 git clone *** // 复制ssh链接,克隆
git clone ssh下拉时报错
Cloning into 'demo'... ssh: connect to host github.com port 22: Operation timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

配置解决办法在.ssh文件下创建config文件写入下面配置

Host github.com
User git用户名
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

 保存之后再次执行"ssh -T git@github.com"时,会出现提示,直接回车"yes"即可

posted @ 2023-06-03 10:20  六個字的昵称  阅读(49)  评论(0编辑  收藏  举报