braid
braid copied to clipboard
ssh running under Braid fails to prompt for passphrase on Windows
I am having an issue while adding a mirror by using ssh. I had this error another time and bypassed the error by using https link to the repository.
But this time, i only have ssh access to the repository of the project. I successfully cloned the project by using the SSH link(git clone ssh,) but it does not work passing by braid.
Command line : braid add --verbose ssh://git@IP/rac/project.git Externe/M2M
Output : Braid: Executing git --version` in D:/Devmeon/AMC/erdf-c1c4
Braid: Executing git rev-parse --is-inside-work-tree in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git rev-parse --show-prefix in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git status in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git rev-parse HEAD in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git add .braids.json in D:/Devmeon/AMC/erdf-c1c4 Braid: Adding mirror of 'ssh://git@IP/rac/project.git'. Braid: Executing git --version in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git rev-parse --is-inside-work-tree in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git rev-parse --show-prefix in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git config remote.master/braid/Externe/M2M.url in D:/Devmeon/AMC/erdf-c1c4 Braid: Setup: Mirror 'Externe/M2M' already has a remote. Replacing it (force) Braid: Executing git remote rm master/braid/Externe/M2M in D:/Devmeon/AMC/erdf-c1c4 Braid: Setup: Creating remote for 'Externe/M2M'. Braid: Executing git remote add master/braid/Externe/M2M C:/Users/Tristan/.braid/cache/ssh___git_IP_rac_project.git in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git config remote.master/braid/Externe/M2M.url in D:/Devmeon/AMC/erdf-c1c4 Braid: Executing git clone --mirror ssh://git@IP/rac/project.git C:/Users/Tristan/.braid/cache/ssh___git_IP_rac_project.git in D:/Devmeon/AMC/erdf-c1c4 Braid: Resetting to 'c4d9820'. Braid: Executing git reset --hard c4d98205dd713a7de7c1161664a4f69b056d2216 in D:/Devmeon/AMC/erdf-c1c4 Braid: Shell error: Cloning into bare repository 'C:/Users/Tristan/.braid/cache/ssh___git_IP_rac_project.git'...`
Edit, full error message : `git@IP: Permission denied (publickey). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.`
The indicated command line is working when i execute it outside braid : `D:\Devmeon\AMC\erdf-c1c4>git clone --mirror ssh://git@IP/rac/project.git
Cloning into bare repository 'project.git'... Enter passphrase for key '/c/Users/Tristan/.ssh/id_rsa': remote: Enumerating objects: 63, done. remote: Counting objects: 100% (63/63), done. remote: Compressing objects: 100% (60/60), done. remote: Total 63 (delta 17), reused 0 (delta 0) eceiving objects: 63% (40/63) Receiving objects: 100% (63/63), 24.47 KiB | 501.00 KiB/s, done. Resolving deltas: 100% (17/17), done.`
braid version : braid 1.1.3 git version : git version 2.27.0.windows.1
As I said at https://github.com/cristibalan/braid/issues/90#issuecomment-700711774, in order to troubleshoot this, we'll need to see the full error from git clone
. Either modify your copy of Braid locally as I described there (if you can), otherwise wait for us to release a version of Braid with the error reporting fixed. You could also try manually running the indicated command line in the indicated working directory to see if you can reproduce the problem. Until one of those happens, this issue will be on hold.
I have edited the issue, i modified my local braid copy. And tried to reproduce the problem but it only occurs when using braid.
Thanks for providing the full error. It looks like the problem might be that ssh is unable to prompt for the passphrase when running under Braid because Braid redirects both stdout and stderr and perhaps also stdin. IIUC, ssh uses /dev/tty
to prompt for the passphrase on Linux, precisely to work in case the usual file descriptors are redirected. Maybe this isn't working in Git for Windows's msys2 environment for some reason. I'll need to test this to confirm it. If so, we can see if there's a way Braid can avoid the problem, or we can document it as a limitation.
Possible workarounds:
- Configure ssh so it doesn't prompt for a passphrase when running under Braid, e.g., load the key into an ssh agent (and enter the passphrase) beforehand, or use a different credential helper as suggested here.
- Make your own local clone of the repository for Braid to use and update it before each time you run Braid. When the problem is fixed, you'll just need to edit
.braids.json
to point to the original repository.
Well, i have removed the passphrase from my ssh key using "ssh-keygen -p". And Braid add/update is working as expected, so it is really a problem with passphrase.
Thanks for confirming what the problem was; I've updated the issue title accordingly.
More broadly, thanks for supporting Braid and helping us identify three(!) bugs. I think many more people could benefit from Braid if they knew about it, and I'd like to see how people are using Braid now to see if we can do anything better, but GitHub stars and mentions on the web (including .braids.json
files in people's repos) are an imperfect measure, so bug reports help. Unfortunately, I am pretty busy at the moment and don't know when I'll get around to fixing the bugs.