简体   繁体   English

使Windows Git Bash终端查找.bashrc和.bash_profile的自定义位置

[英]Make Windows Git Bash terminal look to a custom location for .bashrc & .bash_profile

On Windows I have installed Git Bash. 在Windows上,我已经安装了Git Bash。 My HOMEPATH & HOMEDRIVE environment variables are set so that my home directory is M:\\ . 设置我的HOMEPATHHOMEDRIVE环境变量,以便我的主目录为M:\\ As of now I have my .bashrc & .bash_profile files sitting at M:\\ & they work just fine. 截至目前,我的.bashrc.bash_profile文件位于M:\\ ,并且工作正常。

My question: Is there a way to have Git Bash look somewhere other than M:\\ for .bashrc & .bash_profile without changing my HOMEPATH & HOMEDRIVE environment variables? 我的问题:有没有一种方法可以让Git Bash在.bashrc.bash_profile M:\\之外的其他位置上显示,而无需更改我的HOMEPATHHOMEDRIVE环境变量?

For example, I want to keep my system's home directory at M:\\ but move .bashrc & .bash_profile to C:\\my\\new\\location . 例如,我想将系统的主目录保留在M:\\但是将.bashrc.bash_profile移到C:\\my\\new\\location

Those .bash* files are referenced by HOME , so simply set (create) the HOME environment variable to C:\\my\\new\\location 这些.bash*文件由HOME引用,因此只需将HOME环境变量设置(创建)为C:\\my\\new\\location

Then open a bash session and check that your resource files are sourced. 然后打开一个bash会话,并检查您的资源文件是否来源。

HOMEPATH and HOMEDRIVE will be unchanged. HOMEPATHHOMEDRIVE将保持不变。

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

相关问题 还有哪些其他可能的来源 Git Bash 可能来自 ~/.bashrc 和 ~/.bash_profile - What are some other possible sources Git Bash could be pulling from other than ~/.bashrc and ~/.bash_profile 在Windows 10上运行VSCode任务时无法加载.bash_profile或.bashrc - Unable to load .bash_profile or .bashrc when running VSCode tasks on windows 10 Plink不会在连接时提供bashrc或bash_profile - Plink does not source bashrc or bash_profile on connect Windows 10 中“Bash on Ubuntu on Windows”的 .bashrc 位置 - Location of .bashrc for "Bash on Ubuntu on Windows" in Windows 10 运行“ Cygwin.bat”和仅运行“ bash”时的区别(.bash_profile与.bashrc) - Difference when running 'Cygwin.bat' and if just running 'bash' (.bash_profile vs. .bashrc) 适用于 Windows 的 Git:.bashrc 或 Git Bash shell 的等效配置文件 - Git for Windows: .bashrc or equivalent configuration files for Git Bash shell 节点命令在 Windows 上的 git bash 终端中不起作用 - Node command not working in git bash terminal on windows git-bash 生成 default.bashrc - git-bash generate default .bashrc ANSI 颜色不适用于使用 Windows 终端的 Windows 10 上的 Git Bash - ANSI color not working for Git Bash on Windows 10 using Windows Terminal git bash终端增加行数看(windows) - git bash terminal increase number of lines to see (windows)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM