Git push using GitHub token (cmd line)

First, you need to create a GitHub token with the following scopes:

 Scope for the token 

Copy and save the toke, cause you won't be able to see it again!

Once you have the token, you can push your code, after the commit command, using the following:

$ git push https://<GITHUB_ACCESS_TOKEN>@github.com/<GITHUB_USERNAME>/<REPOSITORY_NAME>.git

Note that you can only use the PAT (personal access tokens) for HTTPS git operations. You can see if your repository is using HTTPS or SSH by running the command:

$ git remote -v

If you see something like this:

> origin  git@github.com:USERNAME/REPOSITORY.git (fetch)
> origin  git@github.com:USERNAME/REPOSITORY.git (push)

It means that your git repo is using SSH, and you need to run

$ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

To change the git repo to HTTPS:

$ git remote -v
# Verify new remote URL
> origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
> origin  https://github.com/USERNAME/REPOSITORY.git (push)

Comments

Popular posts from this blog

Remote Control of UR10e via MoveIt (ROS)

Installing External Control URCap on robot Teach Pendant

UR10e control architecture