Can't push to GitHub

I’ve been using GitHub for a few years, although not for a little while until recently. I see now GitHub is deploying/has deployed 2FA and I have registered. That works. Today, though, I’ve found I cannot push my changes to origin: The requested URL returned error: 403

I’ve investigated further and found I needed a Personal Access Token (PAT). So I generated one for fetching and pulling from the remote. Still getting the 403.

I did some more investigating and found I maybe should be inserting my username as part of the GitHub URL: remote.origin.url=https://ReggieMoto@github.com/ReggieMoto/my-repo.git. Tried that and still getting the 403.

I’m certain this is all tied into the 2FA and the PAT somehow. I have all my credentials and am using them correctly, as far as I can tell. However:
git push origin my-repo-branch
Password for ‘https://ReggieMoto@github.com’:
remote: Permission to ReggieMoto/my-repo.git denied to ReggieMoto.
fatal: unable to access ‘https://github.com/ReggieMoto/my-repo.git/’: The requested URL returned error: 403

So, what’s going wrong?

ReggieMoto

Using the PAT instead of your password when pushing should be the only change you need. Does your token have the right scopes? For pushing you’ll definitely need the repo scope, and workflow to add change Actions workflows.

Your remote origin spec format is wrong when using https there’s no user@.

Many thanks, airtower-luna. The missing component was the workflow.

1 Like

Seems to work fine. It just doesn’t prompt me for my username since it’s already embedded within the URL. The problem was the missing workflow scope from the PAT