Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to find/create .git/config file for local configuration for project? [duplicate]

Tags:

git

github

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?

like image 340
darkBlastorise Avatar asked Sep 22 '14 15:09

darkBlastorise


People also ask

Where is my local git config file?

On windows this file can be found at C:\Documents and Settings\All Users\Application Data\Git\config on Windows XP, and in C:\ProgramData\Git\config on Windows Vista and newer.

Is there a git config file?

The Git configuration file contains a number of variables that affect the Git commands' behavior. The . git/config file in each repository is used to store the configuration for that repository, and $HOME/. gitconfig is used to store a per-user configuration as fallback values for the .


2 Answers

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

like image 87
Abhishek Avatar answered Sep 20 '22 15:09

Abhishek


.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 "[email protected]" 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!

like image 28
Mudassir Razvi Avatar answered Sep 21 '22 15:09

Mudassir Razvi