Skip to content

SSH aliasing to custom remote URL #239

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

Open
warent-bottleneck opened this issue Aug 1, 2023 · 4 comments
Open

SSH aliasing to custom remote URL #239

warent-bottleneck opened this issue Aug 1, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@warent-bottleneck
Copy link

Is your feature request related to a problem? Please describe.
My github repo is cloned using an SSH alias, i.e.

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

As a result, the extension doesn't seem to know that my directory points to a github repository

Describe the solution you'd like
Support remote definitions. For example, gitlens solves this with a configuration:

  "gitlens.remotes": [
    {
      "regex": "github-mycompany",
      "type": "Custom",
      "urls": {
        "repository": "https://github.com/${repoBase}/${repoPath}",
        "branches": "https://github.com/${repoBase}/${repoPath}/branches",
        "branch": "https://github.com/${repoBase}/${repoPath}/commits/${branch}",
        "commit": "https://github.com/${repoBase}/${repoPath}/commit/${id}",
        "file": "https://github.com/${repoBase}/${repoPath}?path=${file}${line}",
        "fileInBranch": "https://github.com/${repoBase}/${repoPath}/blob/${branch}/${file}${line}",
        "fileInCommit": "https://github.com/${repoBase}/${repoPath}/blob/${id}/${file}${line}",
        "fileLine": "#L${line}",
        "fileRange": "#L${start}-L${end}"
      }
    }
  ],

Although I don't need anything this advanced. Even something like this would suffice:

"github-actions.remote-url": "https://github.com/mycompany"
@7507032318
Copy link

TFNMPFCB5pEUxuwMnKg7gLJANQ8BcTwfDF

@mark-pictor-csec
Copy link

Maybe not a bug, but my gut feeling is that enhancement means this is very low priority. Until it's fixed, this extension does nothing but cause false alarms for me - since it can't talk to github, it assumes variables are undefined. 😞

@drorata
Copy link

drorata commented Nov 16, 2024

Adding to this, in the case where different GH account are to be used from the same computer, it seems like using SSH aliases is a good approach.

In my case, I have the following ~/.ssh/config:

Host drorata-personal
  Hostname github.com
  User git
  IdentityFile ~/.ssh/personal_id_ed25519
  IdentitiesOnly yes

Host drorata-official
  Hostname github.com
  User git
  IdentityFile ~/.ssh/drorata_official_id_ed25519
  IdentitiesOnly yes

In this case, the origin in an "official" repo is: @drorata-official:drorata-official-username/calling_workflow_with_inputs.git . This seems to break the behavior of this extension.

@nasu-oldhand
Copy link

I'm not sure about the exact authentication method, but I was able to get the VS Code extension to recognize the GitHub repository by adding a remote repository and configuring VS Code settings.

VS Code settings.json:

{
  "github-actions.remote-name": "github-https",
}

Adding the remote repository:

git remote add github-https https://github.com/your-repo-https-url.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog 🗒
Development

No branches or pull requests

5 participants