git TortoiseGit 和 Pageant,每次都要“添加密钥”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7068485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:49:33  来源:igfitidea点击:

TortoiseGit and Pageant, have to "add key" every time

gitwindows-7githubtortoisegitpageant

提问by Rick Hodgin

Background:I'm using git and TortoiseGit with github.com. My development cycle on the .git local branch goes like this:

背景:我在 github.com 上使用 git 和 TortoiseGit。我在 .git 本地分支上的开发周期是这样的:

1) Make whatever changes
2) Right-click on directory, choose "Git Commit -> branch"
3) Input the message and commit
4) Right-click on same directory, choose "Git Push"
5) I choose my options and...

The first time each time I do this each day, Pageant auto-loads in the background and its icon appears in the system tray. But, it is not remembering the private.ppk I had previously loaded the day (or reboot) before.

每天第一次执行此操作时,Pageant 会在后台自动加载,其图标会出现在系统托盘中。但是,它不记得我之前一天(或重新启动)加载过的 private.ppk。

Each time I have to:

每次我必须:

Right-click -> "Add key" -> and then redo 4) and 5) above

and then it works. I have created a manual icon/shortcut I can click which auto-loads:

然后它起作用了。我创建了一个手动图标/快捷方式,我可以点击它自动加载:

"C:\Program Files\TortoiseGit\bin\pageant.exe" c:\path\to\private.ppk

And if I launch with that shortcut, it loads the key into memory and works fine.

如果我使用该快捷方式启动,它会将密钥加载到内存中并正常工作。



Question:How can I get TortoiseGit to remember or pass that "c:\path\to\private.ppk" parameter to pageant so when it auto-loads that first time it also auto-loads my private key?

问题:如何让 TortoiseGit 记住或将“c:\path\to\private.ppk”参数传递给 pageant,以便在第一次自动加载时它也会自动加载我的私钥?

Is there a persistent setting I can use?

有我可以使用的持久设置吗?

Thanks in advance! :-)

提前致谢!:-)

回答by Simon East

I just place a shortcut to pageant.exe with my PPK in my Start Menu "Startup" folder, so that it loads automatically when Windows boots (although it asks for the password then too).

我只是在我的开始菜单“启动”文件夹中放置了一个带有我的 PPK 的 pageant.exe 的快捷方式,以便它在 Windows 启动时自动加载(尽管它也会要求输入密码)。

"C:\Program Files\TortoiseGit\bin\pageant.exe" "D:\Dev\Git Private Key.ppk"

"C:\Program Files\TortoiseGit\bin\pageant.exe" "D:\Dev\Git Private Key.ppk"

回答by ufo

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á!
  1. 打开项目文件夹中的“TortoiseGit > Settings”
  2. 导航到“Git > Remote”
  3. 选择正确的原点
  4. “Putty Key” > “...” > 导航到您的 *.ppk 文件
  5. 瞧!

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

或者简单地在有关“some_project\.git\config”文件中手动添加一个“puttykeyfile”条目:

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

回答by Kris Roofe

C:\Program Files\putty\pageant.exe 1.ppk 2.ppk ...

回答by zds

As @Simon Eaststated it is the right way to load the proper link into the startup folder.

正如@Simon East所说,这是将正确链接加载到启动文件夹中的正确方法。

The other way around this problem for people who use multiple keys, tortoisegit, putty, pageantin both console prompt and in explorer with Tortoisegitwould be to start pageantwhen it is needed (when interacting with remote repository). And use the proper key for each remote repository.

解决此问题的谁使用多个密钥的人的另一种方式,tortoisegitputtypageant在这两个控制台提示符,并在资源管理器与Tortoisegit将开始pageant(与远程仓库交互时),在需要时。并为每个远程存储库使用正确的密钥。

I have wrote the wrapper for Tortoisegit's ssh client which checks the pageant and loads keys depending on what repository it interacts with. At the moment it checks only for github repos and links them keys. but the other bitbuket or gitlabs functionality could be added to the source code.

我已经为 Tortoisegit 的 ssh 客户端编写了包装器,它检查选美并根据它与之交互的存储库加载密钥。目前它只检查 github 存储库并将它们链接起来。但其他 bitbuket 或 gitlabs 功能可以添加到源代码中

It was created just for personal convenience, so do not beat me hard :)

它只是为了个人方便而创建的,所以不要打我:)