Wrestling With SourceTree Credentials

Posted by : on

Category : Guide

Every few months I go through the same wrestling match with SourceTree. It’s the thing where my git-credentials no longer allow me to push changes to a GitHub Actions workflow.

It looks something like this:

Refusing to allow an OAuth App to create or update workflow `.github/workflows/pipeline.yml` without `workflow` scope

For reasons I don’t care to understand, the authentication token generated when SourceTree signs me into GitHub doesn’t include permission to alter GitHub Action workflows.

This happens infrequently enough for me to forget what I did last time to resolve it. I find myself covering the same hastily-googled search results as before, where all my links render in that lovely shade of purple #c58af9 that denotes a visited link.

So when this happened again just recently, I decided to write down the steps I took to resolve it. That way I have a quick reference on hand the next time I forget how to do a thing.

First, we need to install the latest Git Credential Manager Core.

Once installed, tell git to use this as the credential helper:

git config --system credential.helper manager-core

Next, on the GitHub web page navigate to the Profile menu, click settings and from the ‘Developer Settings’ section, create a new Personal Access Token (PAT). Make sure to include the workflow scope.

GitHub Developer Settings

With a fresh PAT created, head back into SourceTree: Tools -> Options -> Authentication and remove all the GitHub credentials. Then from the SourceTree terminal window, push to any repo. The git client will detect that there are no credentials cached and will hand-off control to the Git Credential Manager. It should pop-up with something like this:

GitHub Sign In using PAT

Select the token tab, and paste in the PAT created in the steps above.

Alternatively, if the repos that you’re working with exist under an organisation that enforces OAuth authentication, click the Sign in with your browser button. This will redirect to a web page login on GitHub.

GitHub Sign In using OAuth

That’s it! From here, you’ll be able to push workflow changes from your SourceTree client.


About Aaron White

I'm a Developer Advocate. I aim to make software development more accessible for everyone.

Useful Links