How to Work with GitHub and Multiple Accounts

Tuts+ Code · 78K views · 2011 · 6:10

Open on YouTube

Testing, debugging & developer toolsSoftware practice, open source & careerstutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking how to use multiple GitHub accounts with separate SSH keys on one machine.

Recommended by 2 people across 2 different months, 2016 to 2021.

What it is

A short 2011 screencast from Tuts+ Code showing how to push and pull to more than one GitHub account from one computer. It walks through generating a separate SSH key per account and wiring them up through the SSH config file.

What people said

Recommends ailia · 2019-05 · Stack Overflow · on “Is it possible to have 2 (or more) GitHub accounts, 2 (or more) ssh key in one computer?”

okey, after several trial and error... i finally got it.. now i was able to understand that config code .. the given thread link to me by sir @Pali is the one that solves it... so technically i just followed the tutorial video given in that thread which is this [this video] and that's it... it all worked out, no need to create separate account on windows OS.. just rename the ssh key upon creation and set it to that config file.

Recommends Abu Shoeb · 2021-06 · Stack Overflow · on “Multiple GitHub accounts on the same computer?”

I see a lot of possible workarounds here. As a quick fix, @Greg's one seems relatively easy. However, it's best to set up separate ssh keys for all different accounts in the long run. This video [this video] demonstrates it briefly. Here are the steps mentioned in that video blog [LINK] . Step 1 - Create a New SSH Key for a new account and save it in a separate file (e.g. ~/.ssh/id_rsa_new_account_name), not in the original file i.e. ~/.ssh/id_rsa ssh-keygen -t rsa -C "your-email-address" Step 2 - Attach the New Key Next, login to your second GitHub account Browse to Account Overview , and attach the new key ~/.ssh/id_rsa_new_account_name.pub within the SSH Public Keys section. In the Terminal, t

Cites ricardoramos · 2016-03 · Stack Overflow · on “How to properly configure ssh keys to multiple remote accounts involving github and bitbucket?”

My solution was: My accounts: Bitbucket Usuário: ricardoramos E-mail: ricardoramos.usp@gmail.com Github – 01 Usuário: ricardousp E-mail: ricardoramos@icmc.usp.br Github – 02 Usuário: ricardormoliveira E-mail: ricardo.comp.ufla@gmail.com For each of the accounts performed the following steps: ssh-keygen -t rsa -C "my email" ssh-add ~/.ssh/(key name without the .pub) After the key does not run the command ssh-add -D , because I thought that this command only wipe the chache and in fact this was being my mistake! ssh-add -l go to the directory ~/.ssh if there is no config file, simply create it in the directory ~/.ssh sudo nano config add the following settings in the config file the ssh folder

Cites jayko03 · 2016-06 · Stack Overflow · on “How can I push git with multiple accounts on one machine”

I want to use two different github accounts to separate my school and my personal things. So I found the methods here,( [this video] ) I successfully added two ssh keys on each account and this is my ~/.ssh/config file # Default account Host github.com User git IdentityFile ~/.ssh/id_rsa # Second account Host github.com-SECONDARY User git IdentityFile ~/.ssh/id_rsa_secondary I tried to push it but did not have luck. In the youtube video and its written instruction describe, 1. git remote add origin git@github.com:SECONDARY/testing.git 2. git push -u origin master I thought it is old way, so I did new way like this 3. git remote add origin [LINK] 4. git push -u origin master Then I got this error

Cites user2924482 · 2018-06 · Stack Overflow · on “Git:Adding error adding a second github account "ssh: Could not resolve hostname github-secondUser"”

I'm following the instructions on this video [this video] of how add second github account. But I'm getting this error: ssh: Could not resolve hostname github-secondAccount: nodename nor servname provided, or not known fatal: Could not read from remote repository. Here is what I have done. I add it a second sshkey: id_rsa id_rsa.pub id_rsa_secondAccount id_rsa_secondAccount.pub And also created a config: #first account Host github.com HostName github.com User git IdentityFile ~/.ssh/id_rsa #secondAccount account Host github-secondAccount HostName github.com User git IdentityFile id_rsa_secondAccount echo "# myNewRepo" >> README.md git init git add README.md git commit -m "first commit" git remote

Cites Edmore Musvibe · 2020-06 · Stack Overflow · on “Multiple Github Accounts With Git In Windows”

What you need to do is to create a new ssh key for your second Github account because by default git is using the key from your first Github account and when you try to push from the second account you will get remote: Permission to privateuser/privaterepo.git denied to workuser. workeruser in this case is your first Github account's username. So you cant push to your second Github account using the first Github account's username. Follow this link for help. [this video]

Cites Haoyu Chen · 2021-02 · Stack Overflow · on “Remote: Permission to repo denied at github”

Now I am trying to use my personal account to push code to my personal repo. However, my current laptop also has set up my company git account. That's why I tried to set up different account in terminal. However, after trying various video, including this one [this video] . I still get the error below: remote: Permission to user2/repo.git denied to user1. Could anyone provide any insight to make it work? At least, let me commit as User2, but not User1. Thanks a lot!

Cites Chen Lizi · 2021-06 · Stack Overflow · on “how to upload your local repo to a designated remote repo in Github when you have two Github accounts and one of them is set as default?”

First of all, I tried to edit SSH/config file by adding a newly generated key, its hostname and so forth. Didn't work. Every time I tried to upload a repo to my personal github account, git would try to upload it to my work github account. My question is really, should I modify SSH/config or .git/config, are those two different? For the record, these are the sources of inspiration I am refering to here. (1) [LINK] (2) [this video] neither of them works. In addition, as I opened the SSH/config file, there is no trace of the SSH keys which is connected to my work github account, which I've been using for a while. I literally started using github actively two and a half months ago, and a colleague h