Search code examples
gitcygwinmsysgit

Cygwin git not picking up aliases


I'm using Cygwin and the git (v1.7.9) that came with it by default (/usr/bin/git). I also have msysgit (v1.7.11.msysgit.0) installed. In my .bashrc, I do

export GIT_CONFIG=path_to_.gitconfig

and when I run git config --list, I get the contents of my .gitconfig (relevant excerpt below):

 ...
 alias.co=checkout
 alias.br=branch
 alias.ci=commit
 alias.st=status
 alias.logp=log --pretty=format:"%h - %an, %ar : %s"
 alias.logl=log --pretty=oneline
 alias.graph=log --pretty=format:"%h - %an : %s" --graph
 ...

however, if I run git ci -m "this is a test" I get

 git: 'ci' is not a git command. See 'git --help'.

 Did you mean one of these?
    am
    citool
    commit
    config
    diff
    fsck
    gc
    init
    mv
    rm

Does the git that comes with cygwin have to be set up differently?


Solution

  • Figured, that git will try writing to the .gitconfig file it was loading when aliasing a new command so I ran git config --global alias.testalias random_git_command. Then from my home directory

     grepc -R testalias ./
    

    I was able to determine that it was using ~/.gitconfig. So the solution was to make a symlink ln -s [path_to_desired_.gitconfig] .gitconfig in my home directory.

    Still finding weird that when I ran git config --list I could see the list of aliases, but when I tried running them, git would not recognize them as a valid alias...