Vscode-gitlens: Can't open files in remote when using git@ urls (ssh)

Created on 9 Jun 2017  Â·  23Comments  Â·  Source: eamodio/vscode-gitlens

  • GitLens Version: 3.6.1
  • VSCode Version: 1.13.0
  • OS Version: Ubuntu 16.04

Steps to Reproduce:

  1. git clone ... a repository from github
  2. Open any file
  3. Ctrl-Shift-P -> "Open File in Remote"
  4. You see "There are no entries to pick from"

Am I missing something that GitLens needs to open in GitHub? I'm coming from Sublime Text where I have an extension to do that for me now.

bug

Most helpful comment

Yeah @jens1o is onto it. Here's some better steps to reproduce on one of my OSS projects

  1. Clone https://github.com/zmoazeni/harvested via SSH [email protected]:zmoazeni/harvested.git
  2. Open it in VS Code
  3. Open the README.md
  4. Try to open the file remotely

This is the blurb in .git/config

[remote "origin"]
    url = [email protected]:zmoazeni/harvested.git
    fetch = +refs/heads/*:refs/remotes/origin/*
~/projects/harvested (master) ∴ git remote -v
origin  [email protected]:zmoazeni/harvested.git (fetch)
origin  [email protected]:zmoazeni/harvested.git (push)

All 23 comments

@zmoazeni I can't reproduce this -- is there any special about the repo you are cloning? Or it could possibly be an issue with Ubuntu -- hrm.

It's a private repository, could that be it?

Other than that, no nothing special. I use git all the time locally and I have a GitHubinator in Sublime Text that works just fine.

I have also cloned them via the [email protected]... URL (ssh), so not http.

I have also private repositories, but it's working fine.

But I cloned it with https...

Ah -- ssh url -- that's got to be it. my parsing of that url must be wrong :(

Ahh yeah, I think that it's. I just tested on an open source project I have already cloned using https and it works fine there.

@zmoazeni can you post the format of the url you are using?

Should be somewhat like [email protected]:eamodio/vscode-gitlens.git

Ok great -- just wanted to make sure there wasn't anything else in there for a private repo. :)

no, it's exact the same.

Can one of you check -- is the url in the .git/config file in the [remote "origin"] the same?

I didn't set it up properly, I just got the link from the tool here:
image

(I tested it out with a private repo, the url is the same.)

Yeah, I just want to make sure that is the same url that git puts into the config file for the repo. It definitely is for https, but not sure about ssh -- I thought it had something like ssh: at the start.

Yeah @jens1o is onto it. Here's some better steps to reproduce on one of my OSS projects

  1. Clone https://github.com/zmoazeni/harvested via SSH [email protected]:zmoazeni/harvested.git
  2. Open it in VS Code
  3. Open the README.md
  4. Try to open the file remotely

This is the blurb in .git/config

[remote "origin"]
    url = [email protected]:zmoazeni/harvested.git
    fetch = +refs/heads/*:refs/remotes/origin/*
~/projects/harvested (master) ∴ git remote -v
origin  [email protected]:zmoazeni/harvested.git (fetch)
origin  [email protected]:zmoazeni/harvested.git (push)

@zmoazeni please re-open if you are still having issues in v4.0.1

Awesome! Verified it works. Thanks!

I'm having this issue in 4.3.3, was there any sort of special configuration I need to do to get this to work with ssh?

@eamodio @zmoazeni I am having the same issue as well (on v7.5.10).

I have a ssh cloned repo and it is not parsing the url correctly.

It opens the url in my browser as:

[my repo]/blob/Command%20failed:%20/usr/bin/git%20-c%20core.quotepath=false%20-c%20color.ui=false%20rev-parse%20--abbrev-ref%20--symbolic-full-name%20@%20@%7Bu%7D/[my file]

Is there something I need to configure to make this parse correctly (_besides changing the git repo url to https_)?

@protoEvangelion In this case it looks like GitLens is failing to find the name of the current branch. Can you open a new issue for this, and follow the instructions to attach the output logging.

Also from your repo -- please try running git rev-parse --abbrev-ref --symbolic-full-name "@" "@{u}" and post the output

@eamodio will do thanks for the guidance :smile:

@eamodio Did some more debugging and figured it out.

I work in a really large repo and only need one of the folders so I was opening a folder in VS Code that was nested deeper than the git config file.

So I am guessing that it couldn't find the git file because it is not at the same level as the folder in Code.

That being said, this sounds a feature more than a bug so if this is something that you think would be good to support let me know and I will open up a ticket. If not I totally understanding :smile:

Thanks for all your hard work I am really enjoying Git Lens!

@protoEvangelion Thanks for the investigation. Yes, please open a new issue for that -- I thought I had that scenario working, but I can dig more into it.

I'm not sure if I am doing something different or if it was fixed in the meantime, but either way it seems to handle having VS Code open in a nested folder correctly now :smile: Thanks!

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings