13

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?

darkBlastorise
  • 314
  • 2
  • 3
  • 10
  • `/` is the unix pathname separator; on windows it's `\`. The config file is `config` in the `.git` directory aka `.git` folder. It should have been created by `git init` – jthill Sep 22 '14 at 21:48

4 Answers4

21

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).

Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
Abhishek
  • 391
  • 1
  • 12
8

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

Mudassir Razvi
  • 1,783
  • 12
  • 33
0

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

Lovato
  • 2,250
  • 1
  • 16
  • 22
0

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.

love
  • 1,000
  • 2
  • 16
  • 35