0

I know this maybe a dump question but I seem to be unable to push my local commits up to a new accounts repo in github.

Recently, for a school project, I created a secondary account on Github second_username and forked a school project repo. I worked on it locally in IntelliJ and when I run git push origin master. It does not ask for my login credentials, which usually happens. It returns remote: Permission to second_username/ip.git denied to first_username and fatal: unable to access 'https://github.com/second_username/ip.git/': The requested URL returned error: 403.

I tried changing the git configurations of both local and global username and email to the second_username but it keeps saying that I am trying to push as first_username. I have run through all the settings in git on IntelliJ and it seems correct as my origin remote is set to the correct https url. I suspect it could be due to some login credentials that where unchanged as I always used the first_username while working on IntelliJ before today.

What I'm doing wrong?

SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34
Ken Gondor
  • 115
  • 2
  • 9
  • 2
    Does this answer your question? [Change Git user in IntelliJ IDEA](https://stackoverflow.com/questions/28275397/change-git-user-in-intellij-idea) – ma_jafari Aug 16 '20 at 12:22
  • 1
    Are you on a windows machine? – mnestorov Aug 16 '20 at 12:34
  • I checked the config files my user name and email are both set to the secondary acc username. However whenever i make a commit, amend or rebase anything locally, it keep showsing the author as the first username. It shows an error that my "Name " for my amends does not exist or match any existing author. Yea I am on a windows machine – Ken Gondor Aug 16 '20 at 12:52

2 Answers2

0

Try changing your account in:

File-->Settings--->Version Control -->GitHub

Good luck!

ma_jafari
  • 1,021
  • 1
  • 6
  • 24
0

Ah I managed to solve it. It was related to the windows credential manager saving my other account despite me setting the config file.

Ken Gondor
  • 115
  • 2
  • 9