Search code examples
githubtoken

Personal Access Token


Is there any way to go around Github's personal access token? It is very annoying to copy-paste the token in the terminal whenever you want to push code to Github. I know using 'git config' helps to use it only one time but what if you wanna push code from a different computer or you open a new terminal on the same computer.


Solution

  • If you're on the same computer, you should configure a credential helper to save the token so you don't need to save it. This should work for all terminals on that same computer. The Git FAQ explains this in significant detail.

    If you need to work on another computer, generate an SSH key with ssh-keygen -t ed25519 -f ~/.ssh/id_remote, add it to your GitHub account, copy ~/.ssh/id_remote and its corresponding .pub file to a flash drive, and then push by using GIT_SSH_COMMAND='ssh -oIdentitiesOnly=yes -i /my/flash/drive/id_remote. (You can use a different name than id_remote if you like.)

    If you're using an SSH key, you'll need to clone and push using the SSH URL instead of the HTTPS URL. If you've already cloned with the HTTPS URL, you can update it with something like git remote set-url origin [email protected]:owner/name.git.

    If you're asking if there is a way to continue using a password, then no, there is not.