1

I am trying to commit some changes from my local repository to my GitHub, but when I am trying to PUSH the changes, I am getting this error:

remote: Permission to vivek/abc.git denied to vivekstudent.
fatal: unable to access 'https://github.com/viveksinghggits/bethere.git/': The requested URL returned error: 403

I believe I am getting this error because I am logged into my local git through another account. How can I reset the settings so that I can PUSH the changes to the remote?
The answer that is tagged as possible duplicate doesnt actually addressed the problem that I am facing here, that question is about the protocol that is used to PUSH the changes but my issue is with the account I think.

viveksinghggits
  • 661
  • 14
  • 35
  • Possible duplicate of [Pushing to Git returning Error Code 403 fatal: HTTP request failed](https://stackoverflow.com/questions/7438313/pushing-to-git-returning-error-code-403-fatal-http-request-failed) – Dan Lowe Jul 29 '17 at 14:14
  • @DanLowe that answer is not useful, in my case what I think is that I configured another name(vivekstudent) and emailid earlier some time and now I am trying to `PUSH` the code to my another github account(viveksinghggits). – viveksinghggits Jul 30 '17 at 06:32

2 Answers2

0

First of all you should change the title to something more relevant, like How to change git local account anyhow according to the docs you need to change the email account asosiated with the git installation first check what email/account you are using

$ git config --global user.email
wrong@example.com

then change it by

$ git config --global user.email "correct.email@example.com"

If you want to do this for just one repository omit the --global option

Skaros Ilias
  • 1,008
  • 12
  • 40
0

First of all, set your username and email:

$ git config --global user.name
$ git config --global user.email

Then push like this:

git push https://github.com/viveksinghggits/bethere HEAD:master
Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
rohit negi
  • 56
  • 1
  • 6