Set username and email for msysgit portable
I’m using msysgit for a school project so I can do commits and such while on the computers at school which do not have it installed.
Now the first thing one does when they install git is set up their .gitconfig how they like. However, since I cannot rely on the %HOME% directory of the computer to have the relevant file would using –system instead of –global for the git config command work?
The main settings of course would be user.name and user.email. Would using –system work for those and all other similar settings? Would it save it to the gitconfig of the etc directory where git is installed on my USB drive?
4 Solutions collect form web for “Set username and email for msysgit portable”
You don’t have to expect the .gitconfig to exist. It will be created when you set the user name and email configurations. The README for the portable version recommends that you set the config with
--global option too.
Add yourself a script to the thumb drive that will set the config values you want (as per other responses). Then it’s a one line action to set up all your values.
As far as I can tell from the discussion of this msysgit issue (especially comment 6 and what leads up to it) you should be able to do what you described. Use
--system instead of
git config add user.name ... and the like. That would modify the gitconfig file in the
etc/ directory of the install. (or just modify it by hand, if you have other things you’d like to carry over from whatever standard one you usually use, if any)
That’s the only way I can see that would still also cleanly honor any other relevant gitconfig files (like per-project ones). Then you can just use regular git commands like you would in a normal situation.
Note that while usually
--system refers to
/etc/gitconfig, in the case of a portable install, it refers to the gitconfig file in the
etc/ directory of the install.
I believe this post describes how to achieve what you’re trying to do: