-2

I have multiple PCs at home used by 3 users. Is it possible to access different user github accounts via ssh without creating individual user accounts in each PC ?

  • If each user has their own local user, sure, you can have as many users as you want. Most operating systems allow you to create multiple users each with their own desktop, settings, and so on. – tadman Feb 12 '21 at 22:57

1 Answers1

0

Yes, it is possible to configure multiple different GitHub user accounts with SSH. The Git FAQ has an entry on this.

Do note, however, that doing this exposes you to the risk that someone accidentally or intentionally pushes data with the wrong account or accesses data that they should not, since SSH keys are secrets. For security reasons, each user should have their own account.

Also note that users sharing the same system account will also need to take special care to store their repositories in different directories and configure user.name and user.email appropriately for those directories using Git's includeIf configuration syntax, which you can read about with git config --help. GitHub uses the email in the commits, which usually comes from user.email, to attribute commits to accounts. If you're not sure how to do this, then it's better to create separate users.

bk2204
  • 64,793
  • 6
  • 84
  • 100