Git push using GitHub token (cmd line)
First, you need to create a GitHub token with the following scopes:
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>.gitNote 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 -vIf 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.gitTo 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
Post a Comment