Git bash主目录与Git Bash不同 [英] Git bash home directory different from Git extension than Git Bash
问题描述
如果我从Git Extention( CTRL + G )运行Git bash,我的主目录是%USERPROFILE%,这是正常的。
b如果我从git repo文件夹的上下文菜单运行Git bash,或者如果从开始菜单运行Git bash,我的主目录是%HOME%,这是不同的。
如何设置git bash始终使用%USERPROFILE%作为主目录(我有.ssh文件夹)?
<
$ echo $ HOME
如果可以提供帮助,请在Git Ext上运行git bash / c / Users / mylogin
直接运行git bash上的相同命令:
$ echo $ HOME
/ h
h:
是我的公司主目录
我能做什么?
git bash提供了 msysgit HOME 到 我怀疑,在你的企业环境中, 我删除了第一个候选家庭住址,并且它有效。 If i run Git bash from Git Extention (CTRL+G), my home directory is %USERPROFILE%, which is ok. If I run Git bash from the context menu of a git repo folder, or if I run Git bash from the start menu, my home directory is %HOME%, which is different. How can I set up git bash to always use %USERPROFILE% as home directory (I have the .ssh folder within) ? If it can help, on git bash run from Git Ext, I have : Same command on git bash run directly : What can I do ? The git bash provided with msysgit in its repo is a script you can edit, in order to set I suspect that, in your corporate environment, As the OP Steve B comments: The
I removed the first candidate home location, and it works.
这篇关于Git bash主目录与Git Bash不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!%USERPROFILE%,您可以编辑一个脚本, code>。
它基本上是默认的,除非已经定义 HOME
,git bash脚本不会修改这个价值(但你可以,如果你编辑所说的脚本)。
HOME
被定义为网络驱动器,以便将各种配置文件(maven,ssh,...)存储在远程,安全和备份的驱动器上。
这将解释为什么 HOME
不会被Git bash脚本改变。
Git Extension显然不像第一个脚本那么小心,并会改变/定义它需要的任何值。 OP Steve B 评论: $ b HOME
是设置为Git bash,在 etc / profile
:
#设置USER的主目录
if [-z$ HOME-o! -d$ HOME];那么
HOME =$ HOMEDRIVE $ HOMEPATH
如果[-z$ HOME-o! -d$ HOME];那么
HOME =$ USERPROFILE
fi
fi
$ echo $HOME
/c/Users/mylogin
$ echo $HOME
/h
h:
is my corporate home directoryHOME
to %USERPROFILE%
.
It is basically what it does by default, except if HOME
is already defined, the git bash script won't modify that value (but you can, if you edit said script).HOME
is defined to a network drive, in order for various configuration files (maven, ssh, ...) to be stored on a remote, secure and backed-up drive.
That would explain why HOME
is not changed by the Git bash script.
The Git Extension obviously isn't as careful as the first script, and will change/define whatever value it needs.
HOME
is set, for the Git bash, in etc/profile
:# Set up USER's home directory
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$HOMEDRIVE$HOMEPATH"
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="$USERPROFILE"
fi
fi