简体   繁体   English

使用 VSCode Remote SSH 时,如何在服务器端的 PATH 中添加一些内容?

[英]How do I add something to my PATH on the server side when using VSCode Remote SSH?

I'm using Visual Studio Code's Remote SSH extension to develop code on my university's linux cluster, which still has an older version of git installed (1.8.3.1).我正在使用 Visual Studio Code 的远程 SSH 扩展在我大学的 linux 集群上开发代码,该集群仍然安装了旧版本的 git (1.8.3)。 This causes errors with the "GitLens" extension that I'm also using.这会导致我也在使用的“GitLens”扩展出现错误。

I tried solving this problem by just cloning my own version of git into "~/git" and compiling it there for myself.我尝试通过将我自己的 git 版本克隆到“~/git”并在那里为自己编译来解决这个问题。 Then I added然后我加了

export PATH=$HOME/git:$PATH

to my.zshrc file.到 my.zshrc 文件。

The problem is that vscode doesn't seem to care what I put in the.zshrc file.问题是 vscode 似乎并不关心我在 .zshrc 文件中放了什么。 Is there another way to set a custom git executable on the server side?是否有另一种方法可以在服务器端设置自定义 git 可执行文件?

I also tried doing the same in the ".bashrc" file, just in case vscode uses bash for some reason.我也尝试在“.bashrc”文件中做同样的事情,以防vscode出于某种原因使用bash。 This also didn't work.这也没有奏效。

The commands at the remote end of an SSH tunnel are executed using non-interactive shell so I think ~/.zshrc is not executed. SSH 隧道远程端的命令是使用非交互式 shell 执行的,所以我认为~/.zshrc .zshrc 没有执行。 Use ~/.zshenv or ~/.zprofile .使用~/.zshenv~/.zprofile See http://zsh.sourceforge.net/Doc/Release/Files.html .请参阅http://zsh.sourceforge.net/Doc/Release/Files.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Git时,如何在远程服务器上的Sublime Text 2中自动同步项目? - How do I sync automatically my project in Sublime Text 2 on a remote server when I'm using Git? 如何使用密码将ssh添加到远程服务器 - How to ssh-add to a remote server using a passphrase 当我使用SSH时,我使用-i开关,我是否也需要为我的GIT遥控器做这个? - When I SSH I use the -i switch, do I need to do that for my GIT remote also? 如何通过 SSH 访问远程(远程服务器上的本地 gitlab 实例)存储库? - How do I access a remote (local gitlab instance on remote server) repository over SSH? VScode 远程不使用与本地 vscode 相同的路径 - VScode remote not using the same path as vscode locally 如何在 vscode 中使用 ssh 克隆私有 git 存储库? - How do I clone a private git repo with ssh in vscode? 如何在不使用子模块的情况下在我的存储库中添加/升级​​/降级远程Git项目? - How do I add/upgrade/downgrade a remote Git project in my repository without using submodules? 如何将远程Git存储库添加到Ubuntu服务器? - How do I add a remote Git repository to an Ubuntu Server? 在 git 中,如何将我的标签与远程服务器同步? - In git, how do I sync my tags against a remote server? SSH到远程服务器时,如何强制git使用其他端口? - How do I force git to use a different port when ssh'ing to a remote?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM