Devanshi
Devanshi

Reputation: 77

How resolve error 403 in git?

I have created a blank git repo in my git account and I am trying to push the code from my local machine to it using git bash. The commands that I have used are :

* https://github.com/DevanshiParekh/new-git-project.git
* git push -u origin master

I get the following error while doing so :

$ git push -u origin master
remote: Permission to DevanshiParekh/new-git-project.git denied to debo-prk.
fatal: unable to access 'https://github.com/DevanshiParekh/new-git-project.git/': The requested URL returned error: 403

Here is my config list:

user.name=DevanshiParekh
[email protected]
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
color.ui=auto

$ git remote show origin
* remote origin
  Fetch URL: https://github.com/DevanshiParekh/new-git-project.git
  Push  URL: https://github.com/DevanshiParekh/new-git-project.git
  HEAD branch: (unknown)

Can someone help me resolve this error? Thanks in advance.

Upvotes: 0

Views: 2268

Answers (1)

VonC
VonC

Reputation: 1324268

An https URL should query your GitHub username/password when pushing for the first time (the config user.name/user.email is irrelevant for authentication)

If it does not, then the wrong credentials are cached in the credential helper.
See the result of git config credential.helper to know which one you have.
For instance, on Windows, that would be the Windows Credential Managers.

Another cause (for your username/password to not work) would be if you have activated the 2FA. In which case, you would need to use a PTA (Personnal Access Token).

Upvotes: 1

Related Questions