Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git.bash_配置文件无法使用右键单击_Git_Bash_Git Bash_.bash Profile - Fatal编程技术网

Git.bash_配置文件无法使用右键单击

Git.bash_配置文件无法使用右键单击,git,bash,git-bash,.bash-profile,Git,Bash,Git Bash,.bash Profile,每当我右键单击文件夹并单击Git bash时,我的.bash_配置文件就不起作用。当我用它的桌面图标打开GitBash时,它工作得非常好。这是我的.bash_档案: source ~/git-completion.bash green="\[\033[0;32m\]" blue="\[\033[0;34m\]" purple="\[\033[0;35m\]" reset="\[\033[0m\]" source ~/git-prompt.sh export GIT_PS1_SHOWDIRT

每当我右键单击文件夹并单击Git bash时,我的.bash_配置文件就不起作用。当我用它的桌面图标打开GitBash时,它工作得非常好。这是我的.bash_档案:

source ~/git-completion.bash

green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"

source ~/git-prompt.sh

export GIT_PS1_SHOWDIRTYSTATE=1

export PS1="$green\u$green\$(__git_ps1)$blue \w $ $reset"
我试着搜索,但到目前为止,我没有看到一些答案或至少是回答我问题的提示

顺便说一句,我从udacity的一门课程“使用Git和Github”中获得了这段代码。他们在那里有一个讨论论坛,但我只注册了免费课程,所以我无法访问它


提前谢谢

Bash sources
.Bash\u profile
,如果它是作为登录shell打开的。当您通过右键单击文件夹打开git bash时,它不会作为登录shell打开,因此bash不会源代码
。bash\u profile
。放置设置的正确文件是
.bashrc
,它由bash在交互式非登录shell中提供


只需将
.bash\u profile
重命名为
.bashrc

为避免bash脚本中的冗余内容,您可以使用以下内容创建.bashrc:

if [ -f ~/.bash_profile ]; then
    . ~/.bash_profile
fi

右键单击文件夹打开git bash,然后输入commad
cd
。检查您被带到的目录中是否存在.bash\u配置文件。@Lahiruchanima我尝试右键单击一个文件夹并打开git bash,然后输入cd,然后输入ls-a。该特定目录中存在bash\u配置文件。然后尝试将
.bash\u配置文件
重命名为
.bashrc
,然后重新打开gitbash@LahiruChandima谢谢成功了@Lahiruchanima你能给我解释一下如果我把
.bash\u profile
改成
.bashrc
会发生什么吗?我只想知道
.bashrc
是什么(或者两者之间有什么区别)。