GitBash连接GitHub
文章目录
检查目录是否有SSHKEY文件
cd ~/.ssh
ls -al生成KEY
ssh-keygen -t rsa -C 邮箱
//询问保存目录,回车
//输入密码(上传不想输入密码,请直接回车)
//再次输入密码将密钥添加到SSH AGENT
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa添加SSH KEY到GITHUB
复制KEY到剪贴板
#win10
clip < ~/.ssh/id_rsa.pub
#mac
cat ~/.ssh/id_rsa.pub | pbcopyGitHub -> Account -> SSH KEY -> ADD,粘贴,ADD KEY
测试以上配置是否生效
ssh -T git@github.com拉代码
~~git clone git://github.com:用户名/项目名.git~~
//采用这种方式,push的时候报错,提示换https
git clone git@github.com:用户名/项目名.git新项目关联github仓库
git remote add repoName git@github.com:xxuer/xxproject.gitgit pull repoName mastergit push -u repoName master查看远程仓库url
git remote get-url repoName2022-12-6补充:
解决克隆超时(来源:https://bengsfort.github.io/a...)
ssh -T -p 443 git@ssh.github.com
vi ~/.ssh/config# ~/.ssh/config
Host github.com
Hostname ssh.github.com
Port 443
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论