1

I have an old Github account which works fine and I’ve recently created new Github account.in the new one whenever I’m trying to do git push command I get and error.the scenario is the two ones below and in both scenarios I get an error:

  1. I initialize a local repo and then make a repo (without readme.md file) in my new github account and finally I try to push this local (initialized) repo to my new github account to my github repo.

  2. I create a repo in my new Github account (with readme.md file) and cloning into my machine and after applying some changes and after doing git add and git commit I do the git push command but I got an error

Note: dolatabadiahmad is my new account and ahmaddolatabadi is my old account

$ git push --set-upstream origin master

remote: Permission to dolatabadiahmad/myone.git denied to ahmaddolatabadi.

fatal: unable to access 'https://github.com/dolatabadiahmad/myone.git/':

The requested URL returned error: 403.

Aman
  • 15
  • 4
ahmad
  • 31
  • 1
  • 5
  • Possible duplicate of [Remove credentials from Git](https://stackoverflow.com/questions/15381198/remove-credentials-from-git) – phd Jun 12 '18 at 13:06
  • Please see if this helps: https://stackoverflow.com/questions/63636504/how-to-change-github-local-repo-git-config-credentials-to-circumvent-403/63647344#63647344. – Mate Mrše Sep 04 '20 at 16:31

2 Answers2

0

You may not have more than one free GitHub Account.

Besides of that, you should look for your Git Credentials to check whether the device has already recorded the username and password (since you are using HTTPS method) of your old account.

Geno Chen
  • 4,916
  • 6
  • 21
  • 39
0

account passwords way is not reliable,

better to use git in ssh way

beginning November 13th, 2020, we will no longer accept account passwords when authenticating with the REST API and will require the use of token-based authentication (e.g., a personal access, OAuth, or GitHub App installation token) for all authenticated API operations on GitHub.com.

from github blog

dengST30
  • 3,643
  • 24
  • 25