Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git config alias doesn't work anymore

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!!!

like image 482
Damodar Bashyal Avatar asked Oct 31 '12 01:10

Damodar Bashyal


People also ask

What is ~/ Gitconfig?

gitconfig is used to store a per-user configuration as fallback values for the . git/config file. The file /etc/gitconfig can be used to store a system-wide default configuration. The configuration variables are used by both the Git plumbing and the porcelains.


1 Answers

Check what your HOME references:

echo %HOME%
# or
set HOME

git config --global will reference the HOME path (unless you would use the --file option).
HOME isn't defined by default on Windows, but it is set by the git-cmd.bat script included with msysgit.

@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%
like image 157
VonC Avatar answered Oct 23 '22 13:10

VonC