extrawurst / gitui

Blazing 💥 fast terminal-ui for git written in rust 🦀
MIT License
18.09k stars 550 forks source link

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

Open nuke-web3 opened 5 months ago

nuke-web3 commented 5 months ago

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):

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 commented 5 months ago

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:

extrawurst commented 5 months ago

is there any addional info logged with gitui -l ?

nuke-web3 commented 5 months ago

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: 'git@github.com: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: 'git@github.com: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: 'git@github.com:extrawurst/gitui.git' Some("git") (CredentialType(SSH_KEY | SSH_MEMORY | SSH_CUSTOM))
19:30:23 [DEBUG] (7) asyncgit::sync::remotes::callbacks: creds: 'git@github.com: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
extrawurst commented 5 months ago

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

Liso77 commented 4 months ago

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!

cebarks commented 3 months ago

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)