Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Host association compatibility with ".ssh/config" #293

Open
CiottiGiorgio opened this issue May 24, 2023 · 3 comments
Open

Host association compatibility with ".ssh/config" #293

CiottiGiorgio opened this issue May 24, 2023 · 3 comments

Comments

@CiottiGiorgio
Copy link

When using different ssh keys associated to different profiles, it's usually the norm that people configure their .ssh/config file like so:

Host dev
   HostName dev.example.com
   User john
   Port 2322

Making it such that if the repo is cloned using:
git clone dev:org/project.git

The dev hostname is not correctly resolved and has to be set manually.
This is not a big inconvenience but it would be nice if GitLink is able to parse the config file and understand the real platform that a particular ssh profile/key is being used for.

@Vistritium
Copy link

Vistritium commented Jul 3, 2023

Reading the correct host from config might be some effort, but if we could at least just override the hostname per project that would be already great.
Right now it uses wrong hostname and there is nothing I can do about it, just have to replace it manually every time.

Edit: actually there is a workaround. I created another origin, called it "real" and told gitlink to use this origin, now it works.

@kfirfer
Copy link

kfirfer commented Dec 20, 2023

I have the same problem(kinda)
when I cloned through ssh instead https and also configured the .ssh/config to have 2 different ssh keys with the same git vendor (gitlab in the following example):

.ssh/config:

Host gitlab.com
  HostName gitlab.com
  User git
  IdentityFile ~/.ssh/id_rsa_gitlab_fuzzyme

Host gitlab.com-kfirfer
  HostName gitlab.com
  User git
  IdentityFile ~/.ssh/id_rsa_gitlab_kfirfer

the plugin uses Host gitlab.com-kfirfer (git remote -v) and got bad url + no auto detect
its frasturating even if we need to go through manual process to change all repositories

will be great if we could globally configure the plugin to delete prefix/suffix from the Host
From exampled above, if we could configure to delete the suffix -kfirfer , the plugin could reach gitlab.com

@ben-gibson
Copy link
Owner

Having a hostname override option in the plugin settings would be the easiest solution for this as @Vistritium suggested. This could be a simple input box in the project level settings or a map option at the application level that lets you specify multiple hosts, for example, gitlab.com-kfirfer => gitlab.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants