Let's say you have two users and repos likejordiup/repo1
and not_jordiup/repo2
.
You want to push and pull from them using different accounts.
-
Clone both the repos to your local (can use this approach)
-
Now add these repos to GitHub Desktop via
File --> Add Local Repository
-
Create access tokens for both the accounts. The easiest way to do this is with
gh
cli:
# account one
gh auth login
# then again for account two
gh auth login
# now generate the token
gh auth token
# returns gho_aj0989asf*************
# switch account
gh auth switch
-
Update the value of the remote. Go to
repo1
in GH Desktop,Repository --> Repository Settings
and changeRemote
tohttps:<gtoken1>@github.com/not_jordiup/repo2
and save. -
Now you can push and pull. (Do the same for any repos you wish to access from the other account)!
- You still have to commit using correct email etc which you can do via repo-specific git configuration.
- You cannot open pull requests using the shortcut keys
P.S. if you found this helpful, make sure to ⭐
no its not useful we want visual