SSH vs Tokens
Both SSH and Personal Access Tokens are ways to securely access github without using password.
SSH:
SSH is the traditional approach using SSH protocol that verifies the client with the help of public key private key model and establishes a secure connection. This mechanism enables us to push / pull commits into/ from github repositories without use of passwords. It requires one time setup, and periodically updating the SSH keys.
Personal Access Token:
The personal access token uses HTTPS protocol. This protocol unlike SSH is not blocked by firewalls. This requires an additional credential manager configuration to remember credentials and use them for git remote operations (push, pull, etc). The scope of the token should be selected properly at the time of creation to limit the usage of token for specific requirements. The personal access token additionally enables us to use the APIs exposed by github using curl or any other REST client. This also requires one time setup and it is recommended to periodically update the personal access token.
Recommendations:
Both are secure mechanisms and can be used.
SSH can be preferred when we need to share the private key in external systems to clone private github repositories. This can also be achieved by creating a Personal Access Token with restricted scope.
Which even mechanism is used, please DO NOT SHARE private keys or access tokens with anyone else.
Comments
Post a Comment