Git配置别名不起作用了 [英] Git config alias doesn't work anymore
问题描述
我使用过命令:
git config --global alias.st status
添加我的第一个别名,如后所示 - 我如何在git中命名别名? 然后,我发现它被添加到配置文件中:
C:\ Users \damodar.bash \\.gitconfig
因此,我直接在配置文件中添加了一堆别名,直到今天,当我在安装MYOB软件后不得不重新启动计算机时,它们都完美地运行。
当我试图使用别名没有工作。所以,我使用上面的命令添加了另一个别名,但该文件没有得到更新,但新别名工作正常。
所以在挣扎了一段时间之后, git config --global在哪里写入?]找到配置文件:
git config --global --edit
令我惊讶的是,它显示出不同的位置,并添加了新的git别名。
.gitconfig(〜) - VIM
[gui]
recentrepo = C:/ _ projects / example.com / trunk / bitbucket
[用户]
名称= damu
[别名]
st =状态
<
我使用的是Windows 7和msysgit。
$ b $有没有办法改变回前一个.gitconfig文件的路径? bc:\> echo%HOME%
%HOME%
c:\> set HOME
HOMEDRIVE = U:
HOMEPATH = \\ \\
HOMESHARE = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ code>更新:
关注此帖[在Egit(Eclipse)中更改用户位置(home变量)]设置缺少的HOME环境变量,现在我得到这:
c:\> set HOME
p>
HOME = C:\ Users \damodar.bash
HOMEDRIVE = U:
HOMEPATH = \
HOMESHARE = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ $ p>
这也解决了我的问题。 YAY !!!
解决方案检查
HOME
echo%HOME%
#或
set HOME
git config --global
会引用HOME $ c $ (除非你会使用--file选项)。
HOME不是在Windows上默认定义,但由设置
> @if不存在%HOME%@set HOME =%HOMEDRIVE %% HOMEPATH%
@if不存在%HOME%@set HOME =%USERPROFILE%
I used command:
git config --global alias.st status
to add my first alias as suggested by post - How do I alias commands in git?
Then, I found it being added to config file at:
C:\Users\damodar.bashyal\.gitconfig
So, i added bunch of aliases directly on the config file and all worked perfectly until today when I had to restart my computer after installing MYOB software.
When i tried to use alias none worked. So, i added another alias using above command, but the file didn't get updated but new alias worked fine.
So after struggling for a while found a command at [ Where does git config --global get written to? ] to look for the config file:
git config --global --edit
To my surprise, it was showing different location with new git alias added in it.
.gitconfig(~) - VIM [gui] recentrepo = C:/_projects/example.com/trunk/bitbucket [user] name = damu [alias] st = status
Is there a way to change back path to previous .gitconfig file?
I am using windows 7 and msysgit.
c:\>echo %HOME% %HOME% c:\>set HOME HOMEDRIVE=U: HOMEPATH=\ HOMESHARE=\\agsbs\UserShares\Damodar.Bashyal c:\>echo %HOME% %HOME%
UPDATE: followed this post [ Change User location(home variable) in Egit (Eclipse) ] to set missing HOME environment variable and now i am getting this:
c:\>set HOME HOME=C:\Users\damodar.bashyal HOMEDRIVE=U: HOMEPATH=\ HOMESHARE=\\agsbs\UserShares\Damodar.Bashyal
That also fixed my issue. YAY!!!
解决方案Check what your
HOME
references:echo %HOME% # or set HOME
git config --global
will reference theHOME
path (unless you would use the --file option).
HOME isn't defined by default on Windows, but it is set by thegit-cmd.bat
script included with msysgit.@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH% @if not exist "%HOME%" @set HOME=%USERPROFILE%
这篇关于Git配置别名不起作用了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!