My .gitconfig
file is as follows:
[user]
name = myname
email = asdf@xyz.com
[alias]
co = commit -am
When I'm in Git Bash and I enter:
git co "Macro changes"
I get this error message:
git: 'co' is not a git command.
Why isn't the alias being recognized?
EDIT: I'm running Windows 7. The .gitconfig
file is at C:\Users\[myuserID]\.gitconfig
.
Strangely, I just created another alias:
git config --global alias.st status
Then I ran
git st
which worked. But when I opened C:\Users\[myuserID]\.gitconfig
, the new alias wasn't listed there. So maybe the global config file is somewhere else?
In C:\Program Files (x86)\Git\etc\profile
, there's this definition of HOME
:
# 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
Windows command prompt tells me that %HOMEDRIVE%%HOMEPATH
is P:\
, and sure enough, the new alias st = status
is in a .gitconfig
file there, but not co = commit -am
, which is odd because when I created the co
alias yesterday, I was able to successfully call it.