Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I edit my .git/config file?

How can I edit my .git/config file?

Apparently, my heroku remote is set to something other than heroku; as a result, I am unable to properly deploy my Rails app on Heroku. However, I can't find how to edit it to set it to the right thing.

Where can I find the config file? I can't find a file named that way in my repository or in my Git folder installation. Where should I search for it and can I edit it?

$ git remote -v
heroku  https://git.heroku.com/pure-plateau-4958.git (fetch)
heroku  https://git.heroku.com/pure-plateau-4958.git (push)
origin  [email protected]:vike27/sciencevest100.git (fetch)
origin  [email protected]:vike27/sciencevest100.git (push)

however heroku open doesn't work and heroku support says it is because of the previous afformentioned error in my .git/config file

I am on Windows8

like image 819
coderwannabe2 Avatar asked May 19 '15 09:05

coderwannabe2


People also ask

How do I access git config?

If you want to check your configuration settings, you can use the git config --list command to list all the settings Git can find at that point: $ git config --list user.name=John Doe user.


2 Answers

Your remotes are usually set in your local config file.
The file can be found end edited here: .git/config.
You can edit that directly or use the git config config to set/get entries in it.

git help config for details.

like image 166
Noufal Ibrahim Avatar answered Oct 16 '22 17:10

Noufal Ibrahim


How can I edit my .git/config file?

Don't, unless you know exactly what you're doing. To modify your Git config, you should instead strive to use Git commands only. One reason for avoiding to edit the config file manually is that you may end up corrupting it inadvertently.

Apparently, my heroku remote is set to something other than heroku [...]

If I understand your problem correctly, you want to change the URL associated with the remote called heroku. First, check what the URL currently used is, by running

git remote -v

This command should list the fetch and push URLs associated with the remote heroku. If you find that those URLs are indeed incorrect, then run

git remote set-url heroku <new-url>

to set the URL of your heroku remote to <new-url>.

like image 28
jub0bs Avatar answered Oct 16 '22 16:10

jub0bs