If you use HTTPS with Git on a Mac to access GitHub, then you can continue to do so, just with a personal access token instead of a password. This personal access token is sent over the HTTP protocol just like a password would be. The main differences between using a personal access token and a password are the following:
- The personal access token is generated by a CSPRNG, so it is computationally infeasible for anyone to guess. While users can often pick weak passwords, personal access tokens will never be duplicated across users and will never be weak.
- Personal access tokens can be restricted with scopes to perform only certain activities, unlike passwords. As a consequence, if a PAT is accidentally exposed, the damage is more limited and it can be easily revoked and replaced.
To use a PAT with the Git, you can reset the credentials used in your credential manager by doing this:
$ echo url=https://github.com | git credential reject
Then, next time that Git prompts you for a username and password to access GitHub, enter your username as normal, then generate a PAT with the
repo scope and paste it in as your password. If you’re using a credential manager, which is the default configuration on macOS, from then on, Git will use those credentials to access GitHub.