I want to know how I can create/find a .git/config file for my project, as windows does not allow me to put the "/". Also, is this a file or is it a folder?
Is there a difference between .gitconfig and .git/config?
I want to know how I can create/find a .git/config file for my project, as windows does not allow me to put the "/". Also, is this a file or is it a folder?
Is there a difference between .gitconfig and .git/config?
Yes, there is difference between .gitconfig
and .git/config
.
.git/config
will have the configuration details of your repository. But .gitconfig
will have your user details and the configuration you set for git like user.name
, user.email
, default editor, color setting, etc.
In Windows, you will find the .gitconfig
file in C:\Users\user_name
.
.git/config
file can be located under <git_repository>/.git/
(.git/config
gets created once you run git init
command or you clone an initialized repository).
.gitconfig
is a global configuration file that resides in your HOMEDIR.
.git
is your special directory in any git repo that makes it a 'repo'.
Inside .git is a file called config
that applies all the configurations mentioned in it to that particular repository only.
You can add configurations to either .gitconfig/.git/config using the git config
command.
Eg:
git config user.name "Jane Doe"
adds a user.name entry in your current repository's .git/config file
git config --global user.email "jane.doe@example.com"
adds a user.email entry in your users .gitconfig file, and it will be applicable to all repos under that users.
(Note use of --global)
Using mysysgit has a lot of benefits. Cygwin is also a good option!
Cheers!
.gitconfig holds all your git configuration for your machine. On each repository, there is a .git folder, and inside it, you can find a config file, which holds information for this particular repo.
I recommend, under Windows, to use msysgit, a improved cmd line tool to work with Git.
Actually Git stores configuration options in three separate files, which lets you scope options to individual repositories, users, or the entire system:
repo/.git/config – Repository-specific settings
~/.gitconfig – User-specific settings
This is where options set with the --global flag are stored.
git config --global user.name "Love"
git config --global user.email love@example.com
$(prefix)/etc/gitconfig – System-wide settings.