How to store HTTPS credentials for Git in WSL

If you are stuck on Windows for any reason but got most of your fun Linux tool with you, good chances are you are using Windows Subsystem for Linux (WSL). With it comes a full Linux distribution (I use Ubuntu, but there are plenty of options: Alpine, Debian, Fedore, Kali, openSUSE) backed by their whole package ecosystem behind them. Historically, you could only run command line tools, but even GUI support for running graphical applications is now (since April 2021) available as a preview feature.

Ok, back to this post’s topic: say you are using Git within WSL to work on some code project. But unfortunately, for some reason, that project’s main development server only supports HTTPS authentication. Typically, this would cause you to have to interactively authenticate by Username + Password on every git fetch or git push operation. Not so much fun.

If you are on Linux, you have some options available (with the good recommendation: if SSH is possible, use it!), but under WSL, you can use a simpler trick.

Continue reading “How to store HTTPS credentials for Git in WSL”

How to git push to multiple remotes with one command

There are multiple questions with even more answers on this exact question at Stack Overflow. The simplest answer, which I failed to find again, looks like this. Add the following lines to your repo’s .git/config:

[alias]
	pushall = !git push origin master && git push github master && git push remote3 master

Simply change remote and branch names to fit yours and from thereon, a git pushall will do all the work.