Christoph
Christoph

Reputation: 7063

Git does not find alias command

I have a git alias working when I start the RStudio shell.

If I try to run the alias from a Windows command line, it says "... is not a git command".

In contrast to here, it seems my C:/Users/user/.gitconfig is not found as it is not shown in git config --list --show-origin.

I guess, I have to reference to the file?

How can I do this on windows? Any help is appreciated.

Upvotes: 3

Views: 598

Answers (2)

CodeWizard
CodeWizard

Reputation: 142064

I'm recommending of reading this post to get a full understanding of what is alias and how to set it.

http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/

To answer directly: you need to have .gitconfig in your user directory or any other location which git looks in.


.gitconfig is collecting information in a commutative way:

  • System level - (--system) - OS level

  • User (--global) - The file will be placed under your %HOME% folder.

  • Project (--local) - Specific definitions for the given project. This file is located in .git/config

Upvotes: 1

VonC
VonC

Reputation: 1323953

"I guess, I have to reference to the file? "

You just need to set the HOME environment variable to %USERPROFILE%.
Git search for the global config file in %HOME% (which is not set by default on Windows).

You can find an example in "Git for Windows tip: Setting $HOME and the startup directory" from Daniel Lee.

edit variable HOME

Upvotes: 3

Related Questions