Open tabarra opened 2 years ago
I believe the issue is that the git process used is not connecting to the ssh-agent that was already authenticated on the computer,
Did you try to switch the git instance in preferences?
Yes, I tried both options (local and builtin), and also tried enabling the particular keys on menu > configure ssh keys
, but i think that's just for auth and not signing.
also tried enabling the particular keys on menu > configure ssh keys, but i think that's just for auth and not signing.
All keys there must be unchecked, otherwise Fork will override the ssh-agent configuration.
Still, tried on both git instances, with no checked and still got the same issue. Recent low down below + evidence of it working on CLI.
?? 2022-11-08 04:30:03.723 WindowActivated
?? 2022-11-08 04:30:03.723 Application Window Activated: skip (PreferencesWindow)
?? 2022-11-08 04:30:03.741 Saving custom commands
?? 2022-11-08 04:30:03.741 Saving settings.
?? 2022-11-08 04:30:03.741 RefreshRepositoryData
?? 2022-11-08 04:30:03.741 testrepo RefreshRepositoryDataGitCommand Revisions
?? 2022-11-08 04:30:03.779 testrepo Repository data are equal. No Changes
?? 2022-11-08 04:30:05.954 Git request failed'commit --file="C:/whatever/testrepo/.git/COMMITMESSAGE"':
error: Load key "C:\\Users\\whatever\\AppData\\Local\\Temp/.git_signing_key_tmpp8bavH": invalid format?
fatal: failed to write commit object
?? 2022-11-08 04:30:05.954 Saving testrepo settings.
?? 2022-11-08 04:30:05.954 RefreshRepositoryStatus
?? 2022-11-08 04:30:06.024 Refresh 'testrepo' status. Updated 1 files
?? 2022-11-08 04:30:06.024 RefreshRepositoryData
?? 2022-11-08 04:30:06.024 testrepo RefreshRepositoryDataGitCommand Head, Revisions, LocalBranches, Status
?? 2022-11-08 04:30:06.070 testrepo Repository data are equal. No Changes
?? 2022-11-08 04:30:09.475 WindowActivated
?? 2022-11-08 04:30:09.475 Application Window Activated: skip (ErrorWindow)
? 2022-11-08 04:30:12.247 Cannot find git instance at: ''
?? 2022-11-08 04:30:12.247 Running 'C:\Users\whatever\AppData\Local\Fork\gitInstance\2.36.1\bin\git.exe' with arguments 'version'.
?? 2022-11-08 04:30:12.277 Running 'C:\Program Files\Git\bin\git.exe' with arguments 'version'.
?? 2022-11-08 04:30:12.305 Git Location: C:\Users\whatever\AppData\Local\Fork\gitInstance\2.36.1\bin\git.exe
?? 2022-11-08 04:30:14.929 Git Location: C:\Program Files\Git\bin\git.exe
?? 2022-11-08 04:30:15.933 WindowActivated
?? 2022-11-08 04:30:15.933 Application Window Activated: skip (PreferencesWindow)
?? 2022-11-08 04:30:15.951 Saving custom commands
?? 2022-11-08 04:30:15.951 Saving settings.
?? 2022-11-08 04:30:15.951 RefreshRepositoryData
?? 2022-11-08 04:30:15.951 testrepo RefreshRepositoryDataGitCommand Revisions
?? 2022-11-08 04:30:15.989 testrepo Repository data are equal. No Changes
?? 2022-11-08 04:30:18.083 Git request failed'commit --file="C:/whatever/testrepo/.git/COMMITMESSAGE"':
error: Load key "C:\\Users\\whatever\\AppData\\Local\\Temp/.git_signing_key_tmpyBCSWd": invalid format?
fatal: failed to write commit object
?? 2022-11-08 04:30:18.083 Saving testrepo settings.
?? 2022-11-08 04:30:18.083 RefreshRepositoryStatus
?? 2022-11-08 04:30:18.150 Refresh 'testrepo' status. Updated 1 files
?? 2022-11-08 04:30:18.150 RefreshRepositoryData
?? 2022-11-08 04:30:18.150 testrepo RefreshRepositoryDataGitCommand Head, Revisions, LocalBranches, Status
?? 2022-11-08 04:30:18.196 testrepo Repository data are equal. No Changes
?? 2022-11-08 04:30:23.500 WindowActivated
?? 2022-11-08 04:30:23.500 Application Window Activated: skip (ErrorWindow)
Does commit work without the -S
flag?
Yes, and even still got verified in github.
https://github.com/tabarra/testrepo/commits/main
I couldn't make it work myself even in the command line. I always get the invalid format?
until I run eval "$(ssh-agent)"
and ssh-add -L
first.
Yeah that is required to start the ssh-agent.
Now the question is why Fork is not reusing the agent?
I don't know. Even a new separate terminal window doesn't reuse the agent.
I have added this to my .bash_profile
:
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases#auto-launching-ssh-agent-on-git-for-windows
And after running, it creates a socket and sets these ENV vars:
SSH_AUTH_SOCK=/tmp/ssh-7C0A5y1gicph/agent.852
SSH_ASKPASS=/mingw64/bin/git-askpass.exe
SSH_AGENT_PID=853
Which comes from the ~/.ssh/agent.env
created by the bash)profile config:
SSH_AUTH_SOCK=/tmp/ssh-7C0A5y1gicph/agent.852; export SSH_AUTH_SOCK;
SSH_AGENT_PID=853; export SSH_AGENT_PID;
echo Agent pid 853;
What i think it's happening is that on fork you are probably starting the git process itself instead of bash which runs the git command, so it does not run the script from the link above, which does not set the env vars.
I think it's worth testing if the missing env is the actual issue.
It it something you think you can test or tell me how I can test for myself?
If that is the actual issue, I don't see many good solutions, but some mid ones come to mind:
bash -c "git ....."
;~/.ssh/agent.env
);bash -c env
and extract the SSH_AUTH_SOCK
and SSH_AGENT_PID
lines then set it to the git process you are spawning.What do you think?
I came here looking for an answer to this as well.
I'm using the OpenSSH and SSHAgent that comes bundled with Windows. I've configured the SSH Agent service is set to start automatically.
In my case the answer was as simple as switching the git instance that Fork uses from the Fork instance to the one installed in windows, as alluded to here. Swapped the git instance, and the SSH Signing began working perfectly.
Using v1.77.0.0.
I tried setting up ssh-rsa and also ssh-ed25519 keys, and neither of them work.
I believe the issue is that the git process used is not connecting to the ssh-agent that was already authenticated on the computer, which ends up with an error that looks something like this:
The commit signing works perfectly on CLI, just not on Fork.