gitui icon indicating copy to clipboard operation
gitui copied to clipboard

Fetch with `ssh` works, but pull does not.

Open nuke-web3 opened this issue 1 year ago • 8 comments

Describe the bug

Fetch works... pull doesn't.

To Reproduce Steps to reproduce the behavior:

  1. shift+f -> fetch remote, yubikey touch for SSH, works fine :ok_hand:
  2. p -> pull remote, yubikey touch for SSH, fetch failed: git error: Bad credentials. :sob:

Context (please complete the following information):

  • OS/Distro + Version: Pop!_OS
  • GitUI Version: #2157 branch
  • Rust version: 1.77.0

Additional context

I have multiple ssh and gpg configs that occasionally will error on one that is incorrect, but then try another that is for git - I have not tried to see if that is the issue here, but I do not think it's at play in testing so far.

nuke-web3 avatar Mar 25 '24 23:03 nuke-web3

Update: I am testing against my fork and I can fetch from it and push just fine... but with the remote set to this repo, I get bad credentials on all pull/push/fetch operations :thinking:

So unclear why it kinda works on my remote, but nothing works on this as a remote :shrug:

nuke-web3 avatar Mar 26 '24 00:03 nuke-web3

is there any addional info logged with gitui -l ?

extrawurst avatar Mar 26 '24 16:03 extrawurst

gitui fetch from master here:

19:27:23 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:27:23 [DEBUG] (7) asyncgit::sync::remotes::callbacks: creds: '[email protected]:extrawurst/gitui.git' Some("git") (CredentialType(SSH_KEY | SSH_MEMORY | SSH_CUSTOM))
19:27:26 [TRACE] (1) gitui::app: [src/app.rs:375] update
19:27:26 [TRACE] (1) asyncgit::status: [asyncgit/src/status.rs:102] request: [hash: 4778997356414528227] (type: WorkingDir)
19:27:26 [TRACE] (1) asyncgit::status: [asyncgit/src/status.rs:102] request: [hash: 12826884458498410352] (type: Stage)
19:27:26 [TRACE] (3) asyncgit::status: [asyncgit/src/status.rs:160] status fetched: 12826884458498410352 (type: Stage)
19:27:26 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:27:26 [TRACE] (2) asyncgit::status: [asyncgit/src/status.rs:160] status fetched: 4778997356414528227 (type: WorkingDir)
19:27:26 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:27:26 [DEBUG] (7) asyncgit::sync::remotes::callbacks: creds: '[email protected]:extrawurst/gitui.git' Some("git") (CredentialType(SSH_KEY | SSH_MEMORY | SSH_CUSTOM))
19:27:26 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Pull)
19:27:26 [ERROR] fetch error: git error:Bad credentials.
19:27:26 [TRACE] (1) gitui::app: [src/app.rs:375] update

gitui pull from master:

19:30:21 [TRACE] (1) asyncgit::status: [asyncgit/src/status.rs:102] request: [hash: 14121315089973767102] (type: Stage)
19:30:21 [TRACE] (3) asyncgit::status: [asyncgit/src/status.rs:160] status fetched: 14121315089973767102 (type: Stage)
19:30:21 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:30:21 [TRACE] (2) asyncgit::status: [asyncgit/src/status.rs:160] status fetched: 4965103449275967055 (type: WorkingDir)
19:30:21 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:30:22 [DEBUG] (7) asyncgit::sync::remotes::callbacks: creds: '[email protected]:extrawurst/gitui.git' Some("git") (CredentialType(SSH_KEY | SSH_MEMORY | SSH_CUSTOM))
19:30:23 [DEBUG] (7) asyncgit::sync::remotes::callbacks: creds: '[email protected]:extrawurst/gitui.git' Some("git") (CredentialType(SSH_KEY | SSH_MEMORY | SSH_CUSTOM))
19:30:23 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Pull)
19:30:23 [ERROR] fetch error: git error:Bad credentials.
19:30:23 [TRACE] (1) gitui::app: [src/app.rs:375] update
19:30:23 [TRACE] (1) asyncgit::status: [asyncgit/src/status.rs:102] request: [hash: 13432677788232178716] (type: WorkingDir)
19:30:23 [TRACE] (1) asyncgit::status: [asyncgit/src/status.rs:102] request: [hash: 14977766551226020821] (type: Stage)
19:30:23 [TRACE] (3) asyncgit::status: [asyncgit/src/status.rs:160] status fetched: 14977766551226020821 (type: Stage)
19:30:23 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Pull)
19:30:23 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:30:23 [TRACE] (2) asyncgit::status: [asyncgit/src/status.rs:160] status fetched: 13432677788232178716 (type: WorkingDir)
19:30:23 [TRACE] (1) gitui::app: [src/app.rs:395] update_async: Git(Status)
19:30:24 [TRACE] (1) gitui::app: [src/app.rs:375] update
19:30:24 [TRACE] (1) asyncgit::status: [asyncgit/src/status.rs:102] request: [hash: 14068606657252922944] (type: WorkingDir)

Seems maybe the pull fails once, then succeeds? could be related to round robin trying the SSH in the keyring...? I do have github set explicitly for one key in ~/.ssh/config:

Host github
    HostName github.com
    Port 22
    User git
    IdentitiesOnly yes
    IdentityFile ~/.ssh/github.pub

nuke-web3 avatar Mar 26 '24 19:03 nuke-web3

almost nothing from .ssh/config is currently supported by the libgit2 version we use (see #2096)

extrawurst avatar Mar 27 '24 10:03 extrawurst

gitui fetch from master here:

...
19:27:26 [ERROR] fetch error: git error:Bad credentials.
...

Neither fetch is working (as you could see above). What is worse it fails quietly!

Liso77 avatar Apr 02 '24 08:04 Liso77

I'm also running into this issue when pulling or pushing to a github repo with a yubikey-backed ssh key.

OS/Distro + Version: Fedora 40 GitUI Version: gitui nightly 2024-05-19 Rust version: rustc 1.80.0-nightly (b1ec1bd65 2024-05-18)

cebarks avatar May 19 '24 06:05 cebarks