[英]Why does git freeze on git-credential-osxkeychain sometimes?
When I do cd some-repo; git push origin master
当我做
cd some-repo; git push origin master
cd some-repo; git push origin master
in my bash terminal, it doesn't ask me for username/password because I guess git has already saved that (it was so long ago that I don't remember the details of how that went down). cd some-repo; git push origin master
在我的bash终端中cd some-repo; git push origin master
,它并没有要求我输入用户名/密码,因为我猜git已经保存了该名称(很久以前,我不记得它的详细信息)。 I'm pushing to a GitHub repo as the remote origin. 我正在将GitHub存储库作为远程源。
So I have a C++ program that does a fork and 所以我有一个C ++程序可以执行fork和
execl("/bin/bash", "/bin/bash", "-c", "cd some-repo; git push origin master", (char *)0);
Then waits for the child bash process to finish. 然后等待子bash进程完成。
Sometimes it works just fine, but other times (seemingly randomly) it will freeze up. 有时它可以正常工作,但有时(看似随机)它会冻结。 Looking at the running process hierarchy, I see:
查看正在运行的流程层次结构,我看到:
MyProgram
git
git-remote-http
git
git-credential-osxkeychain
If I kill the child-most git-credential-osx process, my program resumes (because the parent-most git command finishes), with not surprising output such as: 如果我杀死了最子级的git-credential-osx进程,我的程序将继续执行(因为最父级的git命令完成),输出结果并不令人惊讶,例如:
error: git-credential-osxkeychain died of signal 15
error: RPC failed; result=7, HTTP code = 0
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
My question: why does git push origin master
always seem to work (without asking me for any username password or other stdin) in a bash terminal, but hangs (probably asks for something on stdin) on git-credential-osxkeychain sometimes but not other times when I run it from my C++ program? 我的问题:为什么
git push origin master
总是在bash终端中似乎总是工作(不要求我输入任何用户名密码或其他stdin),但有时却挂在git-credential-osxkeychain上(可能在stdin上要求输入)何时从C ++程序运行它?
I tried looking for man page on git-credential-osxkeychain and couldn't really find anything. 我尝试在git-credential-osxkeychain上寻找手册页,但找不到任何东西。 Running it only prints
Usage: git credential-osxkeychain <get|store|erase>
which isn't self-explanatory enough for me. 仅运行它会打印
Usage: git credential-osxkeychain <get|store|erase>
,这对我来说还不言自明。 Thank you! 谢谢!
I'm running OS X 10.8.3; 我正在运行OS X 10.8.3; git version 1.7.12.4 (Apple Git-37);
git版本1.7.12.4(Apple Git-37); GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12).
GNU bash版本3.2.48(1)-发行版(x86_64-apple-darwin12)。
Without much information, my guess is that the hanging depends on whether or not your login keychain is locked at the time. 没有太多信息,我的猜测是挂起取决于您的登录钥匙串是否当时被锁定。 On the Mac, if the login keychain is unlocked, then the query to get your username and password can proceed unhindered.
在Mac上,如果登录钥匙串已解锁,则获取用户名和密码的查询可以不受阻碍地进行。 But if the keychain is locked, then then Mac OS X wants to prompt you for your login password to unlock the keychain.
但是,如果钥匙串被锁定,则Mac OS X会提示您输入登录密码以解锁钥匙串。 I suspect the dialog box is there, just hidden behind something, so you may have missed it.
我怀疑对话框在那里,只是藏在某些东西后面,所以您可能会错过它。 It'll wait for you to type in your password, effectively hanging the process.
它会等待您输入密码,从而有效地挂起该过程。
There is more information on the gitcredential infrastructure here , and more about the API (including the command line for a helper) here . 这里有关于gitcredential基础结构的更多信息,在这里有更多有关API(包括帮助程序的命令行)的信息 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.