I want to use two different github
accounts to separate my school and my personal things. So I found the methods here,(https://youtu.be/fnSRBRiQIU8)
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 https://github.com/SECONDARYusername/testing.git
4. git push -u origin master
Then I got this error message
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Aren't line 1 and 3 equivalent? Is there other method that I can use two accounts on one machine? Thanks!