I have the following Git configuration file (I'm using plink because this host is configured with a TPMVSC-backed SSH key):
# This is Git's per-user configuration file.
[user]
name = James Edington
email = [email protected]
[core]
sshCommand = plink -batch
[ssh]
variant = plink
[credential "ssh://git-codecommit.us-east-1.amazonaws.com"]
username = ABCDEFGHIJKLMNOPQRST
However, Git doesn't actually seem to be passing this username to plink.
There are a few workarounds I've found, such as:
- Baking my username into the repository URL:
git clone ssh://ABCDEFGHIJKLMNOPQRST@git-codecommit… - Baking my username into the SSH command:
(export GIT_SSH_COMMAND="plink -batch -l ABCDEFG…"; git clone ssh://git-codecommit.us…/project && cd project && git config --local core.sshCommand "$GIT_SSH_COMMAND")
But I'm wondering what the proper solution is.
I have tried setting ssh.variant to plink, auto, and ssh; none of these works. Passing GIT_TRACE=1 reveals that Git isn't passing a username parameter on the command-line to plink in any case.
I have also tried adding an appropriate entry to %USERPROFILE%\.ssh\config, but plink does not seem to load this file.
It seems like Git's not picking up the per-host credential directive, but according to the documentation, I think it should match as I've written it:
both protocols are the same, both hosts are the same, and the "pattern" URL does not care about the path component at all.
Is Git truly bugged not to actually support per-host usernames with plink at this time? Or am I doing something wrong?
Question asked in the context of Git 2.38.1.windows.1; PuTTY-CAC Plink Release 0.77; Windows 10.0.19044; Amazon CodeCommit server.
Both variants will require changing
core.sshCommandalso