Git ssh is not working on git gui, how to fix that?

Viewed 808

I have setup ssh access using git bash and able to do all the operations on private repos.

But, with Git GUI I am not able to do these operations, it seems not able to pick the ssh key using git gui.

The process I followed is described in this link.

It is working with Git Bash but not working with Git GUI.

GIT GUI

When I do push form "Git GUI",it is failing error screen

When I do push from "Git Bash",it is successful success from bash

2 Answers

The warning "This repository moved. Please use the new location:" as seen in this issue, is a bit strange.

Try the ssh scheme URL ssh://git@github.com/<user>/<repo> to see if there is any difference.

But to set also in your Git bash session the GIT_SSH_COMMAND environment variable to see more clues:

export GIT_SSH_COMMAND='ssh -v'

Git GUI will look in your C:\Users\<User>\.ssh folder for a config file. If you add a config file (no extension) you can add the paths of your keys. Otherwise git GUI will only look for default key names. For some reason Git GUI doesn't execute ~/.profile or ~/.bashrc (Git Bash does), which can be used to autostart ssh agent and add keys.

This type of config file worked for me:

IdentitiesOnly=yes
PreferredAuthentications publickey
PasswordAuthentication no
IdentityFile C:\Users\<user>\.ssh\id_ed25519_your_key
IdentityFile /c/Users/<user>/.ssh/id_ed25519_your_key
IdentityFile ~/.ssh/id_ed25519_your_key

Any of the three path notations work. See https://linux.die.net/man/5/ssh_config for syntax of the config file.

Related