DEV Community

Alexey Lysenko
Alexey Lysenko

Posted on

Manage multiple GitHub accounts on one Windows machine (HTTPS)

When you starting to work on commercial projects, often you have to manage multiple GitHub accounts. For comfortable push/pull your code between repositories from different accounts, we can youse simple and efficient setup.

Let's say you previously use git on your machine and configure git global config file. To check it open the terminal and :

git config --global -e
Enter fullscreen mode Exit fullscreen mode

It opens you editor, and you may see something like this:

[user]
    email = yourEmail@gmail.com
    name = Your_Name
...
Enter fullscreen mode Exit fullscreen mode

And this is great because you can push your code to GitHub account without entering credentials every time.
But what if it needs to push to repo from another account? In this case, git will reject with 403 err, and you must change your global git credentials. To make this comfortable lat set storing a repo name in a credential manager:

git config --global credential.github.com.useHttpPath true
Enter fullscreen mode Exit fullscreen mode

to check it open config one more time

git config --global -e
Enter fullscreen mode Exit fullscreen mode

you will see new config lines

[credential]
    useHttpPath = true
...
Enter fullscreen mode Exit fullscreen mode

The is it. Now when you first time push to any account you will see a pop-up
Screenshot_1

Enter specific for this repo account credentials, and this will "bind" this account for the repo. And so in your machine, you can specify as many accounts/repos as you want.

For a more expanded explanation you can see this cool video that I found on youtube:
https://youtu.be/2MGGJtTH0bQ

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️