fork-dev / Tracker

Bug and issue tracker for Fork for Mac
505 stars 12 forks source link

Multiple ssh config for github.com not working #2142

Open xDelph opened 4 months ago

xDelph commented 4 months ago

Hello

I really love Fork, it replace my old sourcetree in the best way possible But lastly, i start switching between my pro github account and my personal one

Sadly, even if all is working as expected in the terminal (i use Warp), Fork seems to work only with the first ssh config use

Let me explain:

For information, no ssh key are selected in Configure SSH keys, and fork is set to use my mac git instead of it's own instance

Thanks Anyhelp appreciated ^^

DanPristupov commented 4 months ago

i start switching between my pro github account and my personal one ... all is working as expected in the terminal (i use Warp) ... I start my mac, use fork on a repository github.com with pro key, it works. Then switch to a repository github.com with personal key, and it fail with

Yes, but you must tell how you configured that in CLI. How does it recognize which SSH key to use?

xDelph commented 4 months ago

Ah sorry, forget this part I use different hostname Like pro.github.com and perso.github.com And the repositories used the ssh url with the right hostname

Host perso.github.com
    HostName github.com
    UseKeychain yes
    AddKeysToAgent yes
    IdentityFile ~/.ssh/id_rsa_perso
    User xxxxx

Host pro.github.com
    HostName github.com
    UseKeychain yes
    AddKeysToAgent yes
    IdentityFile ~/.ssh/id_pro_ed25519
    User xxxx
xDelph commented 4 months ago

could the type of ssh key be the problem ? (just wonder)

DanPristupov commented 4 months ago

For information, no ssh key are selected in Configure SSH keys, and fork is set to use my mac git instead of it's own instance

Weird. This must already make things work as you wish.

Just to ensure there's no mistake, could you:

xDelph commented 4 months ago

Configure SSH Keys OK -> do nothing Fork git instance -> settings check, how do i check in terminal which git Fork use ? Edit button not found, but git remote get-url origin is ok in terminal Reboot -> done already 5/6 times, do nothing :(

xDelph commented 4 months ago

do you think i can have the installer for 2.40 to try it ? because it not so long that i have this problem :s

DanPristupov commented 4 months ago

Can you check if the log file has any errors? It might contain some clues. The log is located at ~/Library/Logs/Fork.log.

could the type of ssh key be the problem ? (just wonder)

It shouldn't be, but who knows. Can you try to create and use some other key for the pro account?

xDelph commented 4 months ago
🔷[WindowManager.swift:236] > Restore workspace 'Perso' with 1 windows and 2 tabs
🔷[RefreshRepositoryCommand.swift:198] > Refresh 'xxx' data. Updated
🔷[RefreshRepositoryCommand.swift:139] > Refresh 'xxx' status. Updated (0 files)
🔷[GitLfsProgressHandler.swift:42] > Temp LFS progress file: file:///var/folders/ss/m7_3824j2g7b_s27m9pz7vfh0000gp/T/6CDD0A6F-922E-44D7-94EF-80613945DAA4
⚠️[GitRequest.swift:453] > Git error 'pull --rebase=true origin --prune --tags --verbose --progress':
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

❌[ErrorWindowController.swift:25] > connectionError(error: Fork.ConnectionError)
🔷[RefreshRepositoryCommand.swift:139] > Refresh 'xxx' status. Updated (0 files)
DanPristupov commented 4 months ago

do you think i can have the installer for 2.40 to try it ?

https://cdn.fork.dev/mac/Fork-2.40.3.dmg

xDelph commented 4 months ago

sadly still same problem will try to update my personal key to ed encryption as well to have the same type on both

xDelph commented 4 months ago

tried the old version, still the same put ed25519 for both keys, still the same restart after all that, still the same

i don't know what to do anymore

(btw thanks for your quick answer, appreciate that)

it's like once fork use a key to connect ssh url, it use it everywhere (btw i'm using zsh also in terminal, don't know if it can help)

xDelph commented 4 months ago

is there anythin i could still try for you to help on this case ? or do you think it's possible to have kinda like a special version with more logging around this topic to let me try have more intel ?

KOCEAN33 commented 3 months ago

I had same issue and fix it

I follwed this guide https://medium.com/macoclock/my-multi-account-github-workflow-on-mac-133708a93544

my ssh config

Host *
        # UseKeychain yes
        AddKeysToAgent yes
        IdentitiesOnly yes

Host github.com
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_rsa

Host github.com-work
        HostName github.com
        User git
        IdentityFile ~/.ssh/id_ed25519_work

and i do not change remote repo url to "github.com-work" if you change, terminal git works but fork does not work

and makesure, you have to add ssh keys on fork ssh configure

DanPristupov commented 3 months ago

@KOCEAN33 try to switch Fork to your system git instance