git-branchless
git-branchless copied to clipboard
`git sync --pull`, `git submit` hang indefinitely when asking for password
Description of the bug
This happens when we're being prompted interactively for a password e.g. to authenticate with Github over HTTPS. Askpass-style programs do not read stdin/write stdout, so https://github.com/arxanas/git-branchless/pull/429 doesn't help. Instead, they directly read/write to the terminal (so that the password is hidden).
Furthermore, if the askpass program fails, it seems that Git falls back to prompting on the terminal manually, so there's no way to cancel asking for the password. For example, even when exit 1ing:
$ GIT_ASKPASS='./askpass.sh' git sync -p
branchless: running command: git fetch --all
Fetching origin
Fetching github
exiting 1
error: unable to read askpass response from './askpass.sh'
⠁ Running Git command: git fetch --all (13.1s)
^C
$ cat askpass.sh
#!/bin/sh
echo >/dev/stderr 'exiting 1'
exit 1
Expected behavior
Either the password is prompted or the operation fails immediately.
Actual behavior
Hangs forever.
Version of rustc
No response
Automated bug report
No response
Version of git-branchless
No response
Version of git
No response
You might consider #574
So, in my opinion, sync should not fetch, should not have network activities involved. It should just automatically move all my working commit to a dest.
pull is an extremely easy command, un-pull is not! So just handle the control back to user will solve all your headache.
My workaround is to do the following before a command which runs git fetch:
In my case, I use ssh-agent and ssh-add -K /path/to/key (on macOS) to unlock the key, and then git sync --pull works for me. Does that workaround work for you?