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

Not working with VS Code Remote - SSH extension #734

Closed
ryansully opened this issue May 4, 2019 · 12 comments

Comments

Projects
None yet
2 participants
@ryansully
Copy link

commented May 4, 2019

Issue Type: Bug

The GitLens extension doesn't seem to load at all with the new Remote - SSH extension in VS Code Insiders.

When opening a git-tracked file, there is no current line blame. Debug output shows undefined instead of correct paths, probably because those functions are using file:// protocol for remote SSH paths:

GitService.getRepoPath — e=Uri(file:///home/ryansully/my-app/App.jsx)
GitService.getRepository — e=Uri(file:///home/ryansully/my-app/App.jsx), t={"skipCacheUpdate":true}
GitService.getRepository returned undefined • 11 ms
GitService.getRepoPath returned undefined • 24 ms

Opening the side bar results in the same issues as above, plus an error:

GitService.getStatusForFile — e=undefined, t=/home/ryansully/my-app/App.jsx
[/home/ryansully/my-app] git status --porcelain=v2 -- App.jsx • 10 ms
GitService.getStatusForFile — failed • 10 ms
Error: spawn /home/ryansully/my-app/bin/git EACCES

My git executable is not located at that path, but at /usr/bin/git.

Extension version: 9.6.3
VS Code version: Code - Insiders 1.34.0-insider (473af338e1bd9ad4d9853933da1cd9d5d9e07dc9, 2019-05-01T00:22:05.899Z)
OS version: Windows_NT x64 10.0.17763
Remote OS version: Linux x64 4.4.0-142-generic

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 10, 2019

It sounds like git isn't configured correctly (or at least GitLens can't find it) on the remote server. Can you send full logs that capture the startup and where git is located?

@ryansully

This comment has been minimized.

Copy link
Author

commented May 14, 2019

[2019-05-14 00:06:07:295] [1] GitService.initialize
[2019-05-14 00:06:07:295] [2] GitService.getBuiltInGitApi
[2019-05-14 00:06:07:422] [2] GitService.getBuiltInGitApi completed • 126 ms
[2019-05-14 00:06:07:809] Git found: 2.21.0 @ /home/ryansully/my-app/bin/git • 387 ms
[2019-05-14 00:06:07:809] [1] GitService.initialize completed • 514 ms
[2019-05-14 00:06:07:812] Starting repository search in 1 folders
[2019-05-14 00:06:07:812] [3] GitService.repositorySearch(/home/ryansully/my-app) searching (depth=1)...
[2019-05-14 00:06:07:833] [4] GitUri.fromUri — e=Uri(file:///home/ryansully/my-app/App.jsx)
[2019-05-14 00:06:07:833] [5] GitService.getRepoPath — e=Uri(file:///home/ryansully/my-app/App.jsx)
[2019-05-14 00:06:07:834] [6] GitService.getRepository — e=Uri(file:///home/ryansully/my-app/App.jsx), t={"skipCacheUpdate":true}
[2019-05-14 00:06:07:835] [7] LineAnnotationController.resume
[2019-05-14 00:06:07:836] [7] LineAnnotationController.resume completed • 0 ms
[2019-05-14 00:06:07:836] [8] LineAnnotationController.refresh
[2019-05-14 00:06:07:836] [9] LineAnnotationController.clear
[2019-05-14 00:06:07:836] [9] LineAnnotationController.clear completed • 0 ms
[2019-05-14 00:06:07:873] GitLens (v9.7.3) activated • 659 ms
[2019-05-14 00:06:07:883] [8] LineAnnotationController.refresh completed • 47 ms
[2019-05-14 00:06:07:883] [/home/ryansully/my-app] git rev-parse --show-toplevel • 70 ms 
[2019-05-14 00:06:07:898] [a] LineAnnotationController.clear
[2019-05-14 00:06:07:898] [a] LineAnnotationController.clear completed • 0 ms
[2019-05-14 00:06:09:309] [3] GitService.repositorySearch(/home/ryansully/my-app) searching in '/home/ryansully/my-app'...
[2019-05-14 00:06:09:327] [/home/ryansully/my-app] git rev-parse --show-toplevel • 18 ms 
[2019-05-14 00:06:09:327] [3] GitService.repositorySearch(/home/ryansully/my-app) returned 0 repositories • 1515 ms
[2019-05-14 00:06:09:425] [6] GitService.getRepository returned undefined • 1591 ms
[2019-05-14 00:06:09:440] [/home/ryansully/my-app] git rev-parse --show-toplevel • 15 ms 
[2019-05-14 00:06:09:440] [5] GitService.getRepoPath returned undefined • 1606 ms
[2019-05-14 00:06:09:440] [4] GitUri.fromUri returned GitUri(file:///home/ryansully/my-app/App.jsx) • 1607 ms
[2019-05-14 00:06:09:440] [b] GitService.getRepository — e=GitUri(file:///home/ryansully/my-app/App.jsx)
[2019-05-14 00:06:09:441] [b] GitService.getRepository returned undefined • 0 ms
[2019-05-14 00:06:09:451] [] git ls-files -- /home/ryansully/my-app/App.jsx • 9 ms 
[2019-05-14 00:06:09:451] [c] GitService.isTracked returned false • 10 ms — e=GitUri(file:///home/ryansully/my-app/App.jsx)
[2019-05-14 00:06:09:452] [d] LineAnnotationController.clear
[2019-05-14 00:06:09:452] [d] LineAnnotationController.clear completed • 0 ms
[2019-05-14 00:06:28:316] [e] LineAnnotationController.clear
[2019-05-14 00:06:28:316] [e] LineAnnotationController.clear completed • 0 ms

I noticed the Git found path points to /home/ryansully/my-app/bin/git, which is a directory in my repo with utility shell scripts, but not a git executable. Perhaps that is confusing the extension?

@ryansully

This comment has been minimized.

Copy link
Author

commented May 14, 2019

I managed to get GitLens working by following the instructions for the second step here: microsoft/vscode-remote-release#31 (comment)

Open the settings editor. There is now a new tab label Remote (SSH: ). Go to the tab, search for 'git path'. This will allow you to specify a custom path for git.

In my case, I set this in my remote host, ~/.vscode-remote/data/Machine/settings.json:

"git.path": "/usr/bin/git"

(VS Code sees this as an unknown configuration setting for remote settings, possibly another bug.)

After reloading the window, GitLens works again, although now it sees users as offline in preview dialogs.
Screenshot 2019-05-13 19 30 51

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 15, 2019

@ryansully GitLens searches for a git executable if it isn't explicitly set or in the path. In your case (given the logs above) It seems to have found /home/ryansully/my-app/bin/git and when run with --version returned 2.21.0. Any idea how that could be?

@ryansully

This comment has been minimized.

Copy link
Author

commented May 15, 2019

I think there may be a bug in VS Code regarding the remote git path, which, in combination with my remote system's configuration, triggers an unusual edge case in this extension.

When I explicitly configured git.path in remote settings above, the editor didn't recognize it as a known configuration setting, which may indicate that when git.path is not explicitly set, it doesn't have a value in the remote system. If my suspicion is correct, then that is the potential VS Code bug.

With that in mind, when the extension is initialized and passes the git path to findGitPath, it defaults to "git" if path is falsy, so when findSpecificGit runs with --version, it's running whichever git executable is defined in the environment's PATH.

However, when findSpecificGit evaluates the if statement after that and runs findExecutable and subsequently runDownPath, runDownPath finds my-app/bin/git (because I have my-app/bin in my PATH defined before the executable's path) and returns that as the git path instead of the executable.

So GitService.initialize and Git.setOrFindGitPath ultimately run the git executable to get the version, but findSpecificGit returns the path to my-app/bin/git directory because that is the first match in my PATH variable.

I should be able to work around this on my end by either renaming the bin/git directory, or changing its order in my PATH variable, but runDownPath should also probably guard against matching directories and only match git executable files in case the workarounds I described aren't possible.

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 15, 2019

@ryansully Thank you so much for the in-depth explanation! I've tweaked some of that code, to ensure the version information comes from the right executable, and that we search for executable files only.

Can you try out this build to see if it helps? Thanks!
gitlens-9.7.4.vsix.zip

@ryansully

This comment has been minimized.

Copy link
Author

commented May 17, 2019

That build is better. The correct executable is found, so line blame works again.

The hover still has the "offline" message that I mentioned above, which I think is a separate bug with the Team Chat extension, but maybe related to the Live Share integration?

The side bar, however, still doesn't work fully. The Repositories pane works, but File History and Line History don't load. And an error is thrown:

cannot open vscode-remote://ssh-remote%2B7b22686f73744e616d65223a2273616e64626f782d7279616e732d3031222c2275736572223a227279616e73227d/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx. Detail: Unable to read file (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx')

That path is wrong. This might be due to my repo /home/ryansully/my-app being symlinked to /home/ryansully/src/team-app, because GitService.repositorySearch is returning 2 repos:

[2019-05-17 01:44:22:866] [3] GitService.repositorySearch(/home/ryansully/my-app) searching in '/home/ryansully/my-app'...
[2019-05-17 01:44:22:953] [/home/ryansully/my-app] git rev-parse --show-toplevel • 86 ms 
[2019-05-17 01:44:22:953] [3] GitService.repositorySearch(/home/ryansully/my-app) found repository in '/home/ryansully/src/team-app'
[2019-05-17 01:44:22:954] [3] GitService.repositorySearch(/home/ryansully/my-app) returned 2 repositories (/home/ryansully/src/team-app, /home/ryansully/src/team-app) • 2406 ms
[2019-05-17 01:44:23:067] [/home/ryansully/src/team-app] git remote -v • 65 ms 
[2019-05-17 01:44:23:068] [26] GitRemoteParser.parse completed • 1 ms
[2019-05-17 01:44:23:111] [6] GitService.getRepository returned undefined • 2530 ms
[2019-05-17 01:44:23:111] [c] GitService.getRepositories completed • 2129 ms
[2019-05-17 01:44:23:111] [15] GitService.getRepository returned undefined • 1802 ms
[2019-05-17 01:44:23:111] [1e] GitService.getRepository returned undefined • 1802 ms
[2019-05-17 01:44:23:134] [b] GitService.getOrderedRepositories completed • 2152 ms
[2019-05-17 01:44:23:135] [27] GitService.getStatusForRepo — e=/home/ryansully/src/team-app
.
.
.
[2019-05-17 01:44:23:463] [32] FileHistoryNode(0).ensureSubscription
[2019-05-17 01:44:23:464] [33] FileHistoryNode(0).subscribe
[2019-05-17 01:44:23:464] [34] GitService.getRepository — e=GitUri(file:///home/ryansully/src/team-app/home/ryansully/my-app/App.jsx repoPath=/home/ryansully/src/team-app)
[2019-05-17 01:44:23:464] [35] LineHistoryNode(0).ensureSubscription
[2019-05-17 01:44:23:464] [36] LineHistoryNode(0).subscribe
[2019-05-17 01:44:23:464] [37] GitService.getRepository — e=GitUri(file:///home/ryansully/src/team-app/home/ryansully/my-app/App.jsx repoPath=/home/ryansully/src/team-app)
[2019-05-17 01:44:23:464] [34] GitService.getRepository returned /home/ryansully/src/team-app • 0 ms
[2019-05-17 01:44:23:464] [37] GitService.getRepository returned /home/ryansully/src/team-app • 0 ms
[2019-05-17 01:44:23:465] [33] FileHistoryNode(0).subscribe completed • 1 ms
[2019-05-17 01:44:23:465] [36] LineHistoryNode(0).subscribe completed • 0 ms
[2019-05-17 01:44:23:465] [32] FileHistoryNode(0).ensureSubscription completed • 1 ms
[2019-05-17 01:44:23:465] [35] LineHistoryNode(0).ensureSubscription completed • 1 ms
[2019-05-17 01:44:23:519] [38] GitService.getStatusForFile — e=/home/ryansully/src/team-app, t=/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx
[2019-05-17 01:44:23:556] [39] GitService.getBlameForRange — e=GitUri(file:///home/ryansully/src/team-app/home/ryansully/my-app/App.jsx repoPath=/home/ryansully/src/team-app), t={"start":{"line":38,"character":17},"end":{"line":38,"character":17},"active":{"line":38,"character":17},"anchor":{"line":38,"character":17}}
[2019-05-17 01:44:23:556] [3a] GitService.getBlameForFile — e=GitUri(file:///home/ryansully/src/team-app/home/ryansully/my-app/App.jsx repoPath=/home/ryansully/src/team-app)
[2019-05-17 01:44:23:647] [3a] GitService.getBlameForFile — failed • 90 ms
Error: cannot open vscode-remote://ssh-remote%2B7b22686f73744e616d65223a2273616e64626f782d7279616e732d3031222c2275736572223a227279616e73227d/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx. Detail: Unable to read file (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx')
[2019-05-17 01:44:23:647] [39] GitService.getBlameForRange — failed • 91 ms
Error: cannot open vscode-remote://ssh-remote%2B7b22686f73744e616d65223a2273616e64626f782d7279616e732d3031222c2275736572223a227279616e73227d/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx. Detail: Unable to read file (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx')
[2019-05-17 01:44:23:648] [/home/ryansully/src/team-app] git status --porcelain=v2 --find-renames= -- home/ryansully/my-app/App.jsx • 128 ms 
[2019-05-17 01:44:23:648] [3b] GitStatusParser.parse completed • 0 ms
[2019-05-17 01:44:23:648] [38] GitService.getStatusForFile completed • 128 ms
[2019-05-17 01:44:23:648] [3c] GitService.getLogForFile — e=/home/ryansully/src/team-app, t=/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx, i={}
[2019-05-17 01:44:23:847] [3c] GitService.getLogForFile — failed • 198 ms
Error: cannot open vscode-remote://ssh-remote%2B7b22686f73744e616d65223a2273616e64626f782d7279616e732d3031222c2275736572223a227279616e73227d/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx. Detail: Unable to read file (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/ryansully/src/team-app/home/ryansully/my-app/App.jsx')
@eamodio

This comment has been minimized.

Copy link
Owner

commented May 17, 2019

@ryansully Thanks so much for the help tracking this down. The issues with the File/Line history sounds like #677 -- which I haven't looked into yet. The other issue with the offline message is confusing -- it seems like there is a broken image link, but I don't see how that could be the case. Although that image is the only image I pull off the local disk in the hover... maybe the path coming back isn't correct -- maybe vscode is returning the path on the remote machine, rather than the local or something like that. I'll need to dig into that more

@ryansully

This comment has been minimized.

Copy link
Author

commented May 17, 2019

The message is less important as the broken image. I realized that I had not reconfigured Team Chat after moving the extension to the remote machine, and once I did that, commit authors displayed as either offline or available. That text is probably just the image's alt text displaying because the image itself is broken.

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 17, 2019

Yeah, that text is the alt text of the image -- just need to figure out why the image is broken (only when remote)

eamodio added a commit that referenced this issue May 17, 2019

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 22, 2019

I'm going to close this as fixed in 9.8. The symlink issue is separate, and the broken image issue is a vscode issue (which I will be filing)

@eamodio eamodio closed this May 22, 2019

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 27, 2019

@ryansully Can you try this version to see if the broken image is fixed?

gitlens-9.8.1.vsix.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.