403 Forbidden error message when you try to push to a GitHub repository using HTTPS

403 Forbidden error message when you try to push to a GitHub repository using HTTPS

I created a new github account and wanted to push my first project to it. This article shows you how to enforce a new password prompt when getting a 403 error during git push.

The problem was I already had another github account that I normally pushed to. So when I wanted to push to my new github account I got following error.

error: The requested URL returned error: 403 Forbidden while accessing https://github.com/github-username/github-repository-name.git/info/refs

To fix it I had to find a way to enforce a new password prompt.

First I checked which url was configured:

git config -l | grep url

which gave me following output:

remote.origin.url=https://github.com/github-username/github-repository-name.git

to enforce now a new password prompt I had to change the github.com to github-username@github.com:

git remote set-url origin "https://github-username@github.com/github-username/github-repository-name.git"

When I tried to push again I was able to type in a password and push to the new github repo.

Did you like it? Why don't you try also...

(Easy to follow) Introduction to AI with K-means, Python and Google Collaboratory

(Easy to follow) Introduction to AI with K-means, Python and Google Collaboratory

In this post we will do our first AI project together using the k-means algorithm with Python to try finding clusters in our spotify data!

Build & Deploy your first blog in under 5 minutes with Gatsby & Surge

Build & Deploy your first blog in under 5 minutes with Gatsby & Surge

If you want to know how to build your own blog in under 5 minutes using Gatsby check out this post.

Top 3 Motivational ways of learning a language

Top 3 Motivational ways of learning a language

In this blog post I want to share my top 3 ways of learning a language in a motivating way.