问题
I recently tried out vscode's remote SSH feature. It was super easy to setup and connect to a remote server.
I opened the editor to a directory that is a git repo and expected to have the default git features working like normal. But if I edit a file, vscode isn't showing the visual indication that there is a modification in the file. And the git tab doesn't show the change. I can open the terminal in vscode and run git status
and I do in fact see the change so I know that's actually editing the file.
If I ssh into the server and run git status
I do notice that vscode updates and now shows the change in the git tab. But there's still no visual indication next to the line number in the actual file that is changed.
回答1:
Follow the instructions at this link, I've changed the value of fs.inotify.max_user_watches
in /etc/sysctl.conf
and everything was ok.
回答2:
Turns out my problem was that I was opening VSCode to a symlinked directory on the remote server. If I instead pointed it to the actual directory everything worked fine!
@depontimatteo's answer might still be relevant if someone is running into this problem with a large codebase.
来源:https://stackoverflow.com/questions/57331868/git-isnt-working-as-expected-with-vscode-remote-ssh