ssh-key

TortoiseGit提交到远程仓库时git did not exit cleanly (exit code 128)

月盾
虽然出现git did not exit cleanly (exit code 128)的情况各有不同,不过其中一种是提交时的读写权限有问题,如果本地代码连接的是SSH仓库,那么可能是服务端没有配置SSH Key。github有两个地方配置sshkey,有一个是全局的,另一个是针对单个仓库的,如果给某个仓库配置了Deploy keys(其实和SSHkey一样),提交另一个代码时就会出现git did not exit cleanly。对于我这种不熟练的人来说就想着再添加一个Deploy keys,但是又提示Key already in use,这时就要看看是不是其他仓库单独配置了ssh key。如果仓库太多具体哪个配置了也不太清楚,有个简单快读的办法是在命令行执行 ssh -T -ai .\id_rsa git@github.com,会告诉你哪个仓库在使用本地的id_rsa内容。删掉Deploy keys,配置为全局SSH Keys就行了

Git SSH Key在windows下生成过程

月盾
切换到C:\Users\\.ssh 执行命令:ssh-keygen -t rsa -C “邮箱地址” Generating public/private rsa key pair. Enter file in which to save the key (//.ssh/id_rsa): 第一次生成由于没有id_rsa文件和id_rsa.pub文件,所以需要生成这两个文件,然后手动输入:./id_rsa Enter file in which to save the key (//.ssh/id_rsa): ./id_rsa,虽然要求输入//.ssh/id_rsa,但这种方式不是在当前目录下 接下来两部是要求输入密码,不输入直接回车就完成了。 PS C:\Users\admin\.ssh> ssh-keygen -t rsa -C "myemail@163.com" Generating public/private rsa key pair. Enter file in which to save the key (//.ssh/id_rsa): ./id_rsa Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in .