E
E
Eugene Chefranov2020-04-14 11:07:03
git
Eugene Chefranov, 2020-04-14 11:07:03

Switching Git Users?

I have two GitHub accounts, one for work and one for my projects. How can I quickly switch between GitHub accounts in Visual Code?

I recently reinstalled Windows, and before reinstalling, when I pushed changes, the Login / Password authorization window appeared in Visual Code, I entered the data and it was hurt. This option was perfect for me. But now, after reinstalling Windows, such a window does not appear, but only one account is used. How to make the authorization window appear every time you push?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2020-04-14
@Chefranov

https://gist.github.com/jexchan/2351996
https://gist.github.com/oanhnn/80a89405ab9023894df7

M
Mikhail Osher, 2020-04-14
@miraage

Did similar. All work projects were in a certain folder, personal randomly. Something like that:

- /Projects
    - <company-name>
        - work-project-1
        - work-project-2
    - personal-project-1
    - personal-project-2

Then we go to gitconfig and add some magic
// ~/.gitconfig
[includeIf "gitdir:/Projects/<company-name>/"]
    path = ~/.gitconfig-company-name

// ~/.gitconfig-company-name
[user]
    email = [email protected]
[core]
    sshCommand = "ssh -i ~/.ssh/id_rsa_company_name.pub"

Most likely, it will be necessary to dance with a tambourine around core.sshCommand, but somehow it should work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question