3

when ever I try to push from device to GitLab server I keep getting error

remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.com/help/topics/git/troubleshooting_gi
t#error-on-git-fetch-http-basic-access-denied

Now hear me out completely before reacting, I do know there are many questions similar to this , like

GitLab remote: HTTP Basic: Access denied and fatal Authentication

but here is where my problem lies, This issue only occurs for one project , for other projects in the same device and same location (I mean same SSD) to same Gitlab account there is no issue I'm, able to push and pull without any problem.

I could use the access token to resolve this issue, but why is it require only for one project and not for the others?

PS: I'm facing this issue both in my editor and terminal

Akash Jain
  • 684
  • 9
  • 23
  • you've cloned the project from http url? or ssh url? – Monish Khatri Sep 03 '22 at 17:00
  • The link you cited (https://stackoverflow.com/a/52092795/421195) is a good one. Q: What OS is your Git client running on? Windows? If so, have you checked Windows Credential Mgr? Q: Have you compared project settings between your "one" and "the others" (e.g. `git config --list`)? Q: Have you compared GitLab rep settings? – paulsm4 Sep 03 '22 at 17:09
  • @paulsm4 yes, i have checked their settings both in my device and gitLab they are same, it's running in Windows but if the credential Manger was an issue it should effect all my projects and not just one. – Akash Jain Sep 03 '22 at 20:41
  • @MonishKhatri i have initialized both the projects from my device using `git init` they were not created in git and then cloned. – Akash Jain Sep 03 '22 at 20:43
  • 1
    Have you tried to use SSH instead of HTTPS? That should overcome the 2FA hurdle the error is prompting. – Prav Sep 04 '22 at 00:13
  • @AkashJain , Yes you haved init in local but from which url you've cloned the projects. – Monish Khatri Sep 04 '22 at 06:39
  • @MonishKhatri do you mean `origin add` ? – Akash Jain Sep 05 '22 at 07:21

1 Answers1

0

Check first the exact URL used for pushing:

cd C:\path\to\repository
git remote -v

Since you have created them locally, that means you must have set the remote "origin" at some point. (git remote add origin https://gitlab.com/you/YourRemoteRepo)

Check also the cached credentials.

In a CMD, make sure:

  • the <path/to/Git>/mingw64/bin is in your %PATH%/$PATH: that is where git-credential-manager-core will reside (for recent Git versions anyway 2.35+).
  • the <path/to/Git>/usr/bin is in your %PATH%/$PATH: that is where printf will reside (needed for Windows OS which does not have a built-in shell printf command in its shell).

From there:

printf "host=github.com\nprotocol=https" | git credential-manager-core get
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250