git问题:git提交的时候总是提示key加载失败,总是需要手工将key加到Pageant中

时间:2021-07-19 12:10:02

问题描述:

重装过一次系统,在重装之前git+tortoisegit配合很好,提交的时候都能自动加载ppk,但是重装系统后,也重新生成pulic key上传到了服务器,但是每次提交的时候都提示key加载失败,必须手工的将key加载到pageant中才可以正常提交
问题分析:
每个git项目的config文件都保存了ppk的地址,重装完系统重新生成key后,ppk的保存路径和文件名都发生了变更,所以导致每次提交的时候,依据config都找不到ppk的地址,所以报错!
解决办法:
打开TortoiseGit->Settings,然后选择git->Remote,选中origin,然后在Putty Key中指向自己新的ppk文件

参考网址:http://*.com/questions/7068485/tortoisegit-and-pageant-have-to-add-key-every-time

All done very quick and easy if you know the right places:

  1. Open up the "TortoiseGit > Settings" in your project folder
  2. Navigate to "Git > Remote"
  3. Select the correct origin
  4. "Putty Key" > "..." > navigate to your *.ppk file
  5. Voilá!

Or simply manually add a "puttykeyfile" entry in the regarding "some_project\.git\config" file:

[remote "origin"]
url = git@github.com:some_one/some_project.git
fetch = +refs/heads/*:refs/remotes/origin/*
puttykeyfile = C:\\Users\\some_one\\.ssh\\some_one@some.com\\id_rsa.ppk