When I do 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). I'm pushing to a GitHub repo as the remote origin.
So I have a C++ program that does a fork and
execl("/bin/bash", "/bin/bash", "-c", "cd some-repo; git push origin master", (char *)0);
Then waits for the child bash process to finish.
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:
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?
I tried looking for man page on git-credential-osxkeychain and couldn't really find anything. Running it only prints Usage: git credential-osxkeychain <get|store|erase>
which isn't self-explanatory enough for me. Thank you!
I'm running OS X 10.8.3; git version 1.7.12.4 (Apple Git-37); GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…