Maybe I'm blind but I can't find a way to access an organization that has granted me access via SSH key. I know it's a breeze connecting directly to your own account but how would I go about doing this through an organization?
2 Answers
Your account's personal SSH keys identify your GitHub user. If an organization has granted you access, it was done via your GitHub user; an SSH key attached to that user will give you access.
If you want to have separate SSH keys for your organization work (e.g. if you work on another machine), simply add the second key to your personal account.
-
4Figured out it was my own issue. Since I was using a key other than default
id_rsa
I needed to startssh-agent
and runssh-add [key]
Jan 28, 2014 at 5:06 -
1@Chris that would mean im giving access to my organization to access my private repos :scary:– PrathikSep 25, 2020 at 6:47
-
1@PrathikJain, it does nothing of the sort. To do that, your organization would need your private key, which you should always protect carefully.– ChrisSep 25, 2020 at 12:50
-
@Chris this is only partially true. There is a security fault with this approach. Anyone in the organization can clone my personal private repositories. They cannot access my repo in a sense that they cannot list all my repositories, but if they guess the project link, they can clone it. (guessing the project name, is not that difficult)– ErmalFeb 26 at 21:58
-
Support for SSH certificate authorities is available with GitHub Enterprise Cloud and GitHub Enterprise Server 2.19+. For more information, see "GitHub's products."
So if your organization account is not or cannot be subscribed to Enterprise plan (like if you're staying with either free or team plan) then you need to bypass github account as @Chris's answer suggests. (You can do work-arounds making new dedicated Github user for organization, but it complicates security concern as organization's administrator have to take care for that, so maybe that approach is not a wise one.)
If another platform is a choice, bitbucket allows you to do this for free per repository, not user. I use this on my Kiosk running on RaspberryPi so it to pull the update directly from repo. (My team is moving to Github's team plan, so I'm torn apart in between changing deployment scheme to standard ways or keep this one repo on bitbucket for this one purpose.)
For gitlab though, it seems like it hasn't implemented this yet. (Link to issued request.)