'How to open git config file from command prompt - git shell?
I am using multiple git accounts from the same computer. I want to change settings for the accounts. Searched google, but wasn't able to find the command that helps to open the config file.
EDIT : It looks like there are different ways and config files to access github.
The answer given by @Altius and here : gist.github.com/jexchan/2351996
I tried both - after setting up SSH keys for my second account, but both failed to push repository to my second account , but I can see repositories being pushed to my first - default account irrespective of what changes I make to any of the config files.
Solution 1:[1]
- Navigate to your git repo
- enter to
.gitfolder ->cd .git - Open the
configfile asvi config - Add the following
[user]
name = YOUR_USER_NAME
email = YOUR_EMAIL
In your each repository, you can have different git@User and associated git@email
* **Another way to set username and email to specific git repo
To set your username for a specific repository, enter the following command in the root folder of your repository: -
git config user.name "User_Name"
git config user.email "[email protected]"
To set usernme as globally
Open your console and run the following -
git config --list
It will give you present git configuration status.
You can set username as global
git config --global user.name "User_Name"
git config --global user.email "[email protected]"
Hope this would help your query
Solution 2:[2]
Here is a simple step that I used to edit my git/config file
- Open a terminal of your choice. You can also use the shortcut key
Ctrl+Alt+Tto open a terminal. - In your terminal type :
git config --global --editIt will open your global configuration file of git in your default editor. - Change the Settings that you want.
For more info on git config, you can check the entire manual by typing git config --help in your terminal.
Solution 3:[3]
Answer is
git config --global -e
it will open .gitconfig file in your default editor that you should have configured for git.
Table 4. Exhaustive list of core.editor configuration commands
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | avisek_shaw |
| Solution 3 |
