As a developer, on your own machine, you access your code repositories on Github using your credentials, but on a production host one should not use his personal account's password or SSH keys.
But in reality, for productivity reasons or cases where we want to do continuous deployment, we may need to access our github repositories from a server host.
There are several options to solve the problem, but one that was easy for me is the "Personal access tokens" solution, which can be used instead of a password for Git over HTTPS on Github.
To create an access token for each server you need to deploy code to:
Go to your Github settings page, and click on the Personal access tokens link.
Click on "Generate new token", and complete the form by setting the right access scope. For example, you may use the "repo" scope to allow accessing your public and private repositories from the server, which means you are giving read and write access.
When ready, click on the "Generate" button, and your token is generated. Copy it in a safe place, as you would with a password.
After this small procedure, now on your server, you are able to clone one of your repositories by providing the token instead of the password, when asked for the account username and password.
$ git clone https://github.com/your_username/your_code_repo.git Username: your_username Password: your_token
Note that, as for user accounts, tokens can be deleted whenever you want. For security reasons, it is recommended to regularly check how and when they are used, with the status information provided in the Github "Personal access tokens" interface, and to delete any token that you may find is no more in use.