| ssh-keygen -t rsa -f ~/.ssh/id_rsa_github -C "xxx@xxx.com" |
| ssh-keygen -t rsa -f ~/.ssh/id_rsa_xxx_github -C "xxx@xxx.com" |
| $ ls ~/.ssh |
| id_rsa_xxx_github id_rsa_github known_hosts |
| id_rsa_xxx_github.pub id_rsa_github.pub known_hosts.old |
- 进入到 ~/.ssh/ 文件夹下创建一个 config 文件
| $ touch config |
| $ vim config |
| |
| |
| |
| Host github.xxx.com |
| HostName github.xxx.com |
| User git |
| IdentityFile ~/.ssh/id_rsa_xxx_github |
| |
| Host github.com |
| HostName github.com |
| User git |
| IdentityFile ~/.ssh/id_rsa_github |
- 将id_rsa_xxx_github.pub 和 id_rsa_github.pub的值填写到对应的远程仓库


- 清空本地的 SSH 缓存,添加新的 SSH 密钥 到 SSH agent中
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ eval `ssh-agent` |
| Agent pid 852 |
| |
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ ssh-add -D |
| All identities removed. |
| |
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ ssh-add ~/.ssh/id_rsa_xxx_github |
| Identity added: /c/Users/ychen224/.ssh/id_rsa_xxx_github (xxx@xxx.com) |
| |
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ ssh-add ~/.ssh/id_rsa_github |
| Identity added: /c/Users/ychen224/.ssh/id_rsa_github (xxx@xxx.com) |
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ ssh-add -l |
| 3072 SHA256:xxx/xxx xxx@xxx.com (RSA) |
| 3072 SHA256:xxx/xxx xxx@xxx.com (RSA) |
| |
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ ssh -T git@github.com |
| Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. |
| |
| EAD+ychen224@CN-PF36VPKF MINGW64 ~/.ssh |
| $ ssh -T git@github.xxx.com |
| Hi xxx! You've successfully authenticated, but GitHub does not provide shell access. |
| $ git config |
| $ git config |
- 新建1个项目文件夹作为本地仓库,单独设置每个repo 用户名/邮箱
| |
| $ git init |
| $ git config user.email "xxxx@xx.com" |
| $ git config user.name "xxxx" |
| $ git remote rm origin |
| # 远程仓库地址,注意Host名称 |
| $ git remote add origin git@xxx.github.com:githubUserName/repName.git |
| # 查看远程 |
| $ git remote -v |
| git branch -M main |
| git pull |
| remote: Password authentication is not available for Git operations. |
| remote: You must use a personal access token or SSH key. |
| remote: See https://github.dxc.com/settings/tokens or https://github.dxc.com/settings/ssh |
| fatal: unable to access 'https://github.aaa.com/bbb/demo_repo.git/': The requested URL returned error: 403 |
| |
| |
| git clone git@github.aaa.com:bbb/demo_repo.git |

【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-07-13 spring boot应用常用配置
2021-07-13 promise对象