I am on mac OS unlike this post:
I have password configured in GitLab.
I have SSL key created AFTER the project was made on GitLab.
When I use an existing folder for a new project and follow the steps below:
Existing folder
cd existing_folder
git init
git remote add origin https://gitlab.com/sobopla/Geronimod.git
git add .
git commit -m "Initial commit"
git push -u origin master
I am prompted to enter my GitLab username and password. After password is entered I get:
remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://gitlab.com/myname/myproject'
I got the same error and I solved this by :
Apply command from cmd (run as administrator)
git config --system --unset credential.helper
And then I removed gitconfig file from C:\Program Files\Git\mingw64/etc/ location (Note: this path will be different in MAC like "/Users/username")
git pull
or git push
, it asked me for username and password. applying valid username and password and git command working.hope this will help you...
Just add your username before the domain:
https://**username**@gitlab.com/user/projectgit
And the assistant will ask you the password
Strangely enough, what worked for me was to sign out and sign back in to the GitLab web UI.
I have no earthly idea why this worked.
It happen every time I'm forced to change the Windows password and none of above answers helped to me.
Try below solution which works for me:
Go to Windows Credential Manager. This is done in a EN-US Windows by pressing the Windows Key and typing 'credential'. In other localized Windows variants you need to use the localized term (See comments for some examples).
alternatively you can use the shortcut
control /name Microsoft.CredentialManager
in the run dialog
(WIN+R)
There are two ways I got around this problem:
I added my username to the front of the remote URL (https://username@gitRepoURL)
I can't run git config --system --unset credential.helper
from GIT Bash, so I had to open up an Admin Command Prompt and run it there (this assumes you installed GIT such that it can run from both GIT Bash and the Command Prompt). From Bash, I get a "could not lock config file" error.
Go to Control Panel->Credential Manager->Windows Credentials select github or gitlab credentials and modify it. This is for windows10
If your trying to login Gitlab with your existing Git account. You need to reset your password of Gitlab, for the first time.
Note: do not mix GitLab SSL settings and GitLab SSH keys.
If what you have configured in your GitLab profile is an SSH public key, then your HTTPS URL would not use it.
Regarding your HTTPS credentials, double-check:
git config credential.helper
.Same problem with Sourcetree On Mac
Solution: Delete the password in keychain access.
When you try to push again it will ask for your password.
Before any transaction with git that your machine does git checks for your authentication which can be done using
In simple words, this happened because the credentials stored in your machine are not authentic i.e.there are chances that your password stored in the machine has changed from whats there in git therefore
Head towards, control panel and search for Credential Manager look for your use git url and change the creds.
There you go this works with mostly every that windows keep track off
None of the above solutions worked for me and I don't have admin rights on my laptop, but they eventually led me to the git tools credential storage doc :
My setup Windows 10 | git version 2.18.0.windows.1 | Clone through HTTPS link
This solution works if you use wincred as credential helper :
> git config --global credential.helper
wincred
Changing the helper to "cache" should do the trick, as it will ask you to provide your credentials again. To set it to cache, just type :
> git config --global credential.helper cache
Check your update is active:
> git config --global credential.helper
cache
You should now be able to clone / pull / fetch as before.
For Mac user:
It is certainly a bug, ssh works with one of my machines but not the other. I solved it, follow these.
alternatively you can set remote to http by using this command in the existing repo, and use this command git remote set-url origin https://gitlab.com/[username]/[repo-name].git
i removed gitlab credential from 'Credential Manager' in windows and pushed successfully
In my case I reinstalled to the latest version of git (currently 2.16.2). I don't know if it was that my old version of git was outdated, but I read on a github page that this should be done if you stumble into https cloning errors. I figured it was an https cloning error as the error focuses on HTTP Basic
, while GitLab uses HTTPS
. I might be wrong in this thought process, but the solution helped in my case, and I hope this helps anyone in the future!
git config --system --unset credential.helper
then enter new password for Git remote server.
I had the same problem using GitLab, and here's how i fixed it:
Generate an access token: to do so go to settings/access tokens, then give it a name and expiration date and submit.
In your project files open the "config" file in ".git" directory: /.git/config
.
You will find a line like this:
[remote "origin"] url = https://[username]:[token]@your-domain.com/your-project.git
You will have your gitlab username instead of [username], and you should replace [token] with your token generated in step 1.
Save the changes.
Create a new access token from gitlab ->setting --> access token
For me, the following worked:
Do not use your GitLab password, but create an access token and use it instead of your password:
The only thing that worked for me was using https://username:[email protected]/user/projectgit
instead of https://gitlab.com/user/projectgit
. See https://gitlab.com/gitlab-com/support-forum/issues/1654
go to credential setting on your windows computer and Remove https://gitlab.com/sobopla/Geronimod.git
I beleive I'm little late here. But I think this would help the new peeps!
My Errors were: remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.
remote: You can generate one at https://gitlab.com/profile/personal_access_tokens
fatal: Authentication failed for 'https://gitlab.com/PROFILE_NAME/REPO_NAME.git/'
I'm on Ubuntu but this worked for me:
git clone https://oauth2:[email protected]/PROFILE_NAME/REPO_NAME.git/
GO TO C:\Users\<<USER>> AND DELETE THE .gitconfig file
then try a command that connects to upstream like git clone, git pull or git push
. You will be prompted to re-enter your credentials. Kindly do so.
Go to Windows Credential Manager (press Windows Key and type 'credential') to edit the git entry under Windows Credentials. Replace old password with the new one.
Open command prompt as administrator then run this command:
git config --system --unset credential.helper
I've faced this same issue after once I've entered the wrong credentials of my git account. The thing that did work for me is, open keychain Access -> Password -> find your entered wrong password and update it and hit save, after that you will be able to perform your operations on git without any issue.
I hope this works for you.
For me it was some other git URL placed in config file, so I did change it manually:
[remote "origin"]
url = [email protected]:prat3ik/my-project.git
And it was working!!
So for me the problem was that I had created my GitLab account via linking my GitHub account to it. This meant that no password formally existed for the account as it was created via hotlink between GitHub and GitLab. I fixed it by going to GitLab Settings -> Password -> and writing the same password as my GitHub account had.
it worked for me: I use Mac and I wrote the path on finder:
~/Library/Application Support/SourceTree
I deleted the auth file which should be like
then tried to push and pull the code from the source tree and it worked.
You can also read the following answers:
I tried with browser URL for the repository then
git clone $(browserURL)
it prompted for my username and then my password
It worked fine then
When the Windows Credential Manager asks for your credentials to access GitLab, those are username and password you use when accessing GitLab. EG: use your email and password.
On mac use KeyChain -> Login -> Password: change password
Try this:
C:/Users/(YourUserName)/
.gitconfig
I had the same issue but before I went ahead to implement any of the suggestions on here, I checked if I was still logged into my github account. I had the problem while working in my Gitlab account. I found out I was still logged into my Github account and I logged out of the account immediately. I tried to clone again in Gitlab and I didn't have the error and the clone was successfully.
It happens if you change your login or password of git service account (GitHub or GitLab, Bitbacket, etc). You need to change it in Windows Credentials Manager too.
So, type "Credential Manager" (rus. "????????? ??????? ??????") in Windows Search menu and go to your git service account and change data too.
Well, I faced the same issue whenever I change my login password.
Below is the command I need to run to fix this issue:-
git config --global credential.helper wincred
After running above command it asks me again my updated username and password.
Just for reference, I encountered this issues while using the URL wrongly after I generated and pasted the ssh_rsa.pub
to the SSH Keys in gitlab.
$ git clone http://gitlab.x
Cloning into 'start-up'...
remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'api' scope for Git over HTTP.
remote: You can generate one at http://gitlab.x
Solved by using the following URL instead.
$ git clone [email protected]/your_project.git
If you are using git > 2.11 and using Kerberos to interact with Gitlab you need set this configuration in your local git to avoid the remote: HTTP Basic: Access denied
error.
$ git config --global http.emptyAuth true
When I had the same problem,
I solved it by removing the file "passwd" in
C:\Users\<USERNAME>\AppData\Local\Atlassian\SourceTree
After removing Sourcetree will prompt for the password.
Note:
OS Version : win10
Sourcetree Version: 3.1
Source: Stackoverflow.com