Conversation
Replace `~` with `/github/home` when used for a file path in the options of a git configuration. For some reason, git does not resolve it and ignores the errors (probably just defaults) when the files do not exist. Passing it `~/.ssh/id_rsa` was not an issue though as it is the default SSH PK file.
BEFORE MERGINGYou might want to put the resolution of |
Bug reported and PR to resolve: yesolutions/mirror-action#19
|
Probably the GIT_SSH_NO_VERIFY_HOST: "true"with: GIT_SSH_KNOWN_HOSTS: ${{ secrets.GIT_SSH_KNOWN_HOSTS }} |
| if [[ "${GIT_SSH_KNOWN_HOSTS}" != "" ]]; then | ||
| echo "${GIT_SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts | ||
| git config --global core.sshCommand "ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=~/.ssh/known_hosts" | ||
| git config --global core.sshCommand "ssh -i /github/home/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=/github/home/.ssh/known_hosts" |
There was a problem hiding this comment.
👋 New user of the action here and running into this issue.
To simplify things, I would suggest not setting the -i and -o UserKnownHostsFile arguments at all. The action is already writing the key and known_hosts to the default locations, so the default settings should be sufficient.
| git config --global core.sshCommand "ssh -i /github/home/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=/github/home/.ssh/known_hosts" | |
| git config --global core.sshCommand "ssh -o IdentitiesOnly=yes" |
Of course, to ignore host fingerprints, you will still set StrictHostKeyChecking below:
git config --global core.sshCommand "ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=no"
In both cases, you should be able to drop the -i and -o UserKnownHostsFile.
There was a problem hiding this comment.
Update: In addition, you don't need the -o IdentitiesOnly=yes option either. So, you'd only need to define core.sshCommand in the case where you want to ignore fingerprints.
|
Any update ? |
Use absolute path for git config options
Replace
~with/github/homewhen used for a file path in the options of a git configuration. For some reason, git does not resolve it and ignores the errors (probably just defaults too) as the files do not exist.Passing it
~/.ssh/id_rsawas not an issue though as it already is the default private key file ssh uses.Tested and approved
I temporarily published it to the actions marketplace in order to try it with my non-working workflow and it fixed it.