Pushing my commits aren't going to my forked repo

I am having difficulties pushing changes I’ve made to a forked a repo I made.

I wanted to make some changes to the README.md file for my local .NET user group GitHub repo. I forked the repo into a copy of the original under my GitHub account. Since I’m new at this I looked at Kent Dodds tutorial) on how to configure things so my local repo would fetch from the original repo, but I had thought push to my forked repo. Or at least that’s what I thought.

But I’ve made some mistake. After I made edits and committed them locally, I tried to push my changes to my forked repo. However, this is the error I got:

D:\GitHub\nmug.github.io [master ↑1]> git push
remote: Permission to nmug/nmug.github.io.git denied to rfalanga.
fatal: unable to access ‘https://github.com/nmug/nmug.github.io.git/’: The requested URL returned error: 403

So next I entered checked my remotes and here’s what I got:

D:\GitHub\nmug.github.io [master ↑1]> git remote -v
origin https://github.com/rfalanga/nmug.github.io.git (fetch)
origin https://github.com/rfalanga/nmug.github.io.git (push)
upstream https://github.com/nmug/nmug.github.io.git (fetch)
upstream https://github.com/nmug/nmug.github.io.git (push)

I want to fetch/pull from upstream, but push to my origin. What have I done wrong and how do I fix it, please?

(I’m using posh-git)

1 Like

If you want git pull without arguments to keep pulling from upstream you’ll need to explicitly push to your origin:

git push origin master

Otherwise you can set the upstream branch, but after that you’d need to explicitly pull from upstream:

git branch --set-upstream origin/master
1 Like

Unfortunately, the git push origin master command didn’t work. After I entered it, then tried to push to my forked branch I still got the same error:

D:\GitHub\nmug.github.io [master ↑1]> git push
remote: Permission to nmug/nmug.github.io.git denied to rfalanga.
fatal: unable to access ‘https://github.com/nmug/nmug.github.io.git/’: The requested URL returned error: 403

I’ll try setting the upstream branch.

1 Like

@airtower-luna, I had to change --set-upstream to --set-upstream-to as the former is no longer supported.

I was able to push my changes to my forked repo. Then I created a PR for the original author to consider.

Thank you for your help.

2 Likes