企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
下载git客户端,选择git安装目录,略... 下载地址:[https://git-for-windows.github.io/](https://git-for-windows.github.io/) **1.查看是否已经有了ssh密钥:** git窗口输入 cd ~/.ssh      然后ll -a查看(.ssh是隐藏文件夹,所以必须加 -a) No such file or directory 表示没有 如果没有密钥则不会有下面的文件,有则备份删除 ![](https://img.kancloud.cn/65/29/65298881c60a17cbc9109b02b6bd46f9_490x129.png) 无则生成秘钥 ``` ssh-keygen -t rsa -C "your@email.com" ``` >[danger]rsa是可自定义的公钥文件名 ![](https://img.kancloud.cn/7f/ff/7fffa0931f87060343724da9cf25727c_794x379.png) 进入到安装目录下,查看生成的**秘钥** ![](https://img.kancloud.cn/cf/45/cf4505b0f27acaafac94122f8c841e52_702x356.png) 登录github.com或者gitee.com配置秘钥 1 ![](https://img.kancloud.cn/05/86/05862b383051b90049b2b2cfe300a8bd_488x311.png) 2 ![](https://img.kancloud.cn/63/e8/63e856067822194299f3fcb55903210f_789x439.png) 3 ![](https://img.kancloud.cn/c8/e1/c8e15a0accc7c28fb8a990812ae97c37_1096x694.png) gitee在SSH公钥选项配置: ![](https://img.kancloud.cn/f6/e7/f6e72e83b5769283d258b799aeb983a6_229x195.png) 链接github确认添加的ssh公共密钥是否有效 ~~~ ssh git@github.com //gitee ssh git@gitee.com ~~~ The authenticity of host 'github.com (192.30.255.113)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts. PTY allocation request failed on channel 0 Hi xxxuser! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed. Administrator@USER-20160524DB MINGW64 ~/Desktop **出现上面所示:** **①** **Warning: Permanently added the RSA host key for IP address '192.30.255.113' to the list of known hosts.** **解决:在hosts****文件夹下添加如下:** ~~~ 192.30.255.113  github.com ~~~ ② The authenticity of host 'github.com (13.229.188.59)' can't be established. RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8. Are you sure you want to continue connecting (yes/no)? 解决:查看ssy是否存在:$ ls -al ~/.ssh 重新生成和配置sshkey第4步和第五步 正常显示如下: ~~~ $ ssh git@github.com //正常情况下,回显如下 PTY allocation request failed on channel 0 Hi plinx! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed. ~~~ >[info]ssh git@gitee.com 7.配置github远程仓库 如果是第一次配置github远程仓库,需要设置用户名和邮箱,并添加远程地址,给远程仓库起个别名 ~~~ git config --global user.name "github用户名" git config --global user.email "your_github_email@qq.com" //查看git配置: git config --lis      q退出 git remote add origin( origin:别名) git@github.com:yourName/yourRepo.git ~~~ ![](https://img.kancloud.cn/c9/1b/c91b28663235c1ac0d0ccea45e607c2c_480x65.png) [git - 虚无缥缈的云 - 博客园 (cnblogs.com)](https://www.cnblogs.com/lichihua/p/7767348.html)