Search code examples
windowsgitgit-config

Invalid key error when using url.<base>.insteadOf on Windows


When I want to predefine URL changes in my global git config on Ubuntu I can use this command: url..pushInsteadOf

https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf

Everything works fine and I get a new entry in my .gitconfig file. However, if I try this on windows with cmd it throws this error:

error: invalid key: url.https://test:[email protected]/MyCompany.insteadOf.https://github.com/MyCompany

How can I achieve the same on a windows machine?


Solution

  • The proper command to create configuration must be

    git config url.https://test:[email protected]/MyCompany.insteadOf https://github.com/MyCompany
    

    Note the space between the key and the value.

    You also should remove the wrong key from .gitconfig.