sourcegit icon indicating copy to clipboard operation
sourcegit copied to clipboard

Getting Askpass for every action even when its not needed

Open Akira-Kuru opened this issue 5 months ago • 37 comments

I added ssh to the ssh-agent so I don't have to constantly add the password to the sourcegit but it keeps giving me the askpass prompt for pull, push, fetch and commits.

Even when deleting branches I also get the askpass prompt. What I find wild with deleting branches is that if you cancel the askpass prompt, the branch gets deleted either way.

Akira-Kuru avatar Jul 14 '25 12:07 Akira-Kuru

Image

This window is launched by ssh not SourceGit:

https://github.com/sourcegit-scm/sourcegit/blob/0a74dd64ce63cb4def3210291013ab50f80149d6/src/Commands/Command.cs#L167-L175

love-linger avatar Jul 15 '25 03:07 love-linger

Make sure you have enable the AddKeysToAgent configuration in ~/.ssh/config

Host *
  AddKeysToAgent yes

love-linger avatar Jul 15 '25 03:07 love-linger

Hi, I have same problem, mint, manjaro. All time when I want to do some git actions - always prompt for ssh key password

➜  ~ cat ~/.ssh/config
Host *
  AddKeysToAgent yes

piotr-fraczek avatar Jul 16 '25 16:07 piotr-fraczek

If your private key has a passphrase, each time you use it, SSH will ask for its password. You can use ssh-keygen -p -f <private_key> to reset its password to empty.

love-linger avatar Jul 17 '25 01:07 love-linger

I added

Host *
  AddKeysToAgent yes

and the ssh-agent is running on my terminal, however I still receive the AskPass prompt.

I even tried it out with a file creating, deleting, committing and pushing over terminal which worked without any issue. Then the same approach with sourcegit and I still get the prompt.

Then I added this code below in ~/.ssh/config and attempted the same process again.

Host github.com
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_work
  BatchMode yes

This time, sourcegit decided not to commit or push and simply gave me a "Permission denied (publickey)." error even though it works on the terminal. Not giving me any prompt anymore because of BatchMode yes.

I would also not take the ssh-keygen -p -f <private_key> approach since you are not keeping your SSH Key secure this way.

If this was an SSH issue then it would have also happened on the Terminal which it didn't.

Akira-Kuru avatar Jul 18 '25 14:07 Akira-Kuru

This may be because the private_key_file is passed into the SSH command every time in the code:

https://github.com/sourcegit-scm/sourcegit/blob/0a74dd64ce63cb4def3210291013ab50f80149d6/src/Commands/Command.cs#L175-L179

Later, I'll check if there is a better way to handle the SSH connection.

love-linger avatar Jul 18 '25 14:07 love-linger

I test this on Windows platform that when installing GIT, using external openssh (without using the built-in SSH) does not have such problems.

Makes sure ssh-agent service is running

Image

BTW, on which system do you encounter this problem?

love-linger avatar Jul 21 '25 06:07 love-linger

BTW, on which system do you encounter this problem?

I use Linux: Manjaro, Mint, Ubuntu distributions

On Windows 10/11 this problem not exists :)

piotr-fraczek avatar Jul 21 '25 07:07 piotr-fraczek

BTW, on which system do you encounter this problem?

I use Linux: Archlinux & Windows 11.

This happened so far only on Archlinux but I will check Windows later today.

Akira-Kuru avatar Jul 21 '25 07:07 Akira-Kuru

I've test this on Ubuntu. After manually add keys to ssh-agent, it will not ask me for passphrase any more.

eval `ssh-agent -s` # Makes sure `ssh-agent` started
ssh-add <private_key_file> # The `<private_key_file` is the same one with `SSH Private Key` of remote configuration in `SourceGit`

# Then restart `SourceGit` and try to fetch/pull/push/create commit in `SourceGit`

love-linger avatar Jul 21 '25 07:07 love-linger

I think I know why.

  • When I started SourceGit from the terminal session that just runs eval `ssh-agent -s` , this issue does not exists
  • When I started SourceGit from other terminal sessions that have not ran eval `ssh-agent -s` , this issue appears

Maybe, SSH_AGENT_PID and SSH_AUTH_SOCK are needed by ssh command

love-linger avatar Jul 21 '25 07:07 love-linger

Fixed. When creating linux packages, a custom script (instead of symbolic link for /opt/sourcegit/sourcegit) has been added into /usr/bin.

The content of /usr/bin/sourcegit is:

#!/bin/bash

eval `ssh-agent -s`
/opt/sourcegit/sourcegit $@

You can download the latest CI build from Github Action.

love-linger avatar Jul 21 '25 09:07 love-linger

You can download the latest CI build from Github Action.

Just tried it locally and it works but I don't think I can test it out properly through the Terminal.

I just tried the develop branch and it worked but the same happened with master as well which doesn't have your changes. I am guessing the Terminal still executes ssh-agent even after I built and adds this to sourcegit when testing locally.

Akira-Kuru avatar Jul 21 '25 10:07 Akira-Kuru

I will merge develop into master on next Monday.

I don't think I can test it out properly through the Terminal.

This is not important. Because in both non-commandline mode and commandline mode, the executed file is the same one: /usr/bin/sourcegit.

See: sourcegit.desktop

[Desktop Entry]
Name=SourceGit
Comment=Open-source & Free Git GUI Client
Exec=/usr/bin/sourcegit
Icon=/usr/share/icons/sourcegit.png
Terminal=false
Type=Application
Categories=Development
MimeType=inode/directory;

love-linger avatar Jul 21 '25 10:07 love-linger

It is with great sorrow and a heavy heart that I must inform you that I am still getting this bug in version 2025.28.

I am using the AMD64 AppImage under Fedora SilverBlue. Every time I fetch, pull, or push, I'm prompted to input the password for my SSH key ~6 times. I'm going to revert back to 2025.25 for now, which doesn't have this behavior.

BrodyB avatar Jul 31 '25 00:07 BrodyB

I'm going to revert back to 2025.25 for now, which doesn't have this behavior.

Strange.

love-linger avatar Jul 31 '25 03:07 love-linger

Unfortunately, on linux manjaro problem still exists

piotr-fraczek avatar Jul 31 '25 05:07 piotr-fraczek

Try to launch SourceGit from terminal and call eval `ssh-agent -s` first before that

love-linger avatar Jul 31 '25 06:07 love-linger

Try to launch SourceGit from terminal and call eval `ssh-agent -s` first before that

like this?

➜  ~ eval `ssh-agent -s`                                                                  
Agent pid 7729
➜  ~ sourcegit 

prompting for password every time

-- edit --

but if I add manual key

➜  ~ ssh-add ~/.ssh/id_ed25519 
Enter passphrase for /home/piofra/.ssh/id_ed25519: 
Identity added: /home/piofra/.ssh/id_ed25519 (PioFra-ed25519)
➜  ~ sourcegit 

SourceGit don't want password, and git command working ok

piotr-fraczek avatar Jul 31 '25 15:07 piotr-fraczek

but if I add manual key, SourceGit don't want password, and git command working ok

I'm seeing the same thing as Piotr except that manually re-adding my SSH key to ssh-agent has no effect.

BrodyB avatar Jul 31 '25 16:07 BrodyB

I ran into this issue today only after upgrading to 2025.28 and 2025.29. Running ssh-add to re-add my private key didn't help.

However, I just downgraded to 2025.27 and it is back to normal (i.e. not asking for my SSH keyfile password for each action). I'm on Pop!_OS 22.04 LTS.

OldSneerJaw avatar Aug 06 '25 02:08 OldSneerJaw

I've reverted the changes since 2025.27

love-linger avatar Aug 06 '25 04:08 love-linger

Sorry for not coming back on this. The error has been persistent and I went from 2025.26 to 27, 28 and now 29.

On the latest version it still happens but doesn't happen when running over the terminal.

This was already the case on version 2025.26.

I was contemplating if this has to do since I am using zsh and not bash. However, I switched to bash on different Terminal (Konsole, Kitty and Ghostty) I could still pull and push without putting in a password.

Not sure what else I can try to make SourceGit work.

Currently running 2025.29 over AppImage.

Akira-Kuru avatar Aug 08 '25 07:08 Akira-Kuru

I'm seeing the same problem in the latest version of SourceGit 2025.29 on Ubuntu Linux 22.04.5 LTS. Every time I do a Git Fetch, it keeps asking me for the SSH password.

SourceGit Askpass SSH password prompt

But when I run git fetch in a Terminal, I do not get this problem. On the Terminal, it only asks for the password once, after I restart the computer, and then it is saved somewhere so that I don't have to keep retyping it.

This problem did not happen in older versions of SourceGit, like sourcegit-2025.14.linux.amd64.AppImage and sourcegit-2025.25.linux.amd64.AppImage

ozmium avatar Aug 13 '25 08:08 ozmium

@ozmium Could you help me test the latest CI build from Github Action? I have rolled back the relevant code to 2025.14.

https://github.com/sourcegit-scm/sourcegit/actions/runs/16932437575

love-linger avatar Aug 13 '25 09:08 love-linger

@love-linger if you need any tests, I'll be happy to help you. also I can take a look at the code and try see what the problem is.

piotr-fraczek avatar Aug 13 '25 09:08 piotr-fraczek

@piotr-fraczek Thank you very much. You can download and test the latest CI build from Github Action. https://github.com/sourcegit-scm/sourcegit/actions/runs/16932437575

love-linger avatar Aug 13 '25 09:08 love-linger

The source code about SSH settings in git command is https://github.com/sourcegit-scm/sourcegit/blob/e87eb8137bc043e0ca8568ce003fe22c4416dcb1/src/Commands/Command.cs#L175-L187

love-linger avatar Aug 13 '25 09:08 love-linger

@love-linger I can try to help with the testing, but could you please also fix this issue?

  • https://github.com/sourcegit-scm/sourcegit/issues/1725

Please try to add it into the CI build.

ozmium avatar Aug 13 '25 10:08 ozmium

By the way, when I download the SourceGit AppImage on Ubuntu Linux, I always make my own Desktop Icon Launcher, with settings like this:

/home/username/.local/share/applications/SourceGit.desktop

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=SourceGit
Icon=/home/username/Apps/SourceGit.icns
Comment=Source Git Client
#Exec=/home/username/Apps/sourcegit-2025.14.linux.amd64.AppImage
Exec=/home/username/Apps/sourcegit-2025.29.linux.amd64.AppImage
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
#StartupNotify=true

I don't know if this is causing the bug or not.

I use these guides:

  • https://dev.to/duhoang/ubuntu-create-postman-shortcut-31jp
  • https://askubuntu.com/questions/1026528/adding-custom-programs-to-favourites-of-ubuntu-dock

ozmium avatar Aug 13 '25 10:08 ozmium