Git bash 更改默认 .ssh 位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18702660/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git bash change default .ssh location
提问by IndoKnight
I have been struggling to change .ssh location on git bash.
我一直在努力在 git bash 上更改 .ssh 位置。
When I open Git Bash command prompt, I'm typing cd ~/.ssh then my Git Bash navigates to some H:/xyz/.ssh directory. I want to change it to some D:/user/.ssh directory. Sorry, I'm not experienced on UNIX but tried some ways found on internet in vain. Please advise.
当我打开 Git Bash 命令提示符时,我输入 cd ~/.ssh 然后我的 Git Bash 导航到某个 H:/xyz/.ssh 目录。我想将其更改为某个 D:/user/.ssh 目录。抱歉,我在 UNIX 上没有经验,但尝试了一些在互联网上找到的方法,但徒劳无功。请指教。
采纳答案by x29a
In order to change your HOME variable (containing the path to your home directory) you can try different approaches.
为了更改您的 HOME 变量(包含您的主目录的路径),您可以尝试不同的方法。
The linux "inhouse" solution would be to edit your ~/.bashrc file (or create it) to say something like
linux“内部”解决方案是编辑您的 ~/.bashrc 文件(或创建它)以说类似
export HOME="/d/user"
Next time you start GitBash, and type
下次启动 GitBash 时,输入
cd ~/.ssh
it will go into /d/user/.ssh if the directory exists.
如果目录存在,它将进入/d/user/.ssh。
Now according to danlimerickand GregKyou can also set the HOME variable directly in Windows. The links also mention how you can change the startup folder via changing the shortcut properties.
现在根据danlimerick和GregK,您还可以直接在 Windows 中设置 HOME 变量。这些链接还提到了如何通过更改快捷方式属性来更改启动文件夹。