Unlike this post, I am on macOS.
I have the password configured in GitLab. I also have an 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, I am prompted to enter my GitLab username and password.
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
After the password is entered I get the following error.
remote: HTTP Basic: Access denied fatal: Authentication failed for 'https://gitlab.com/myname/myproject'
It happens every time I'm forced to change the Windows password and none of the above answers helped me.
Try the below solution which works for me:
Go to Windows Credential Manager. This is done in an 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) Edit the git entry under Windows Credentials, replacing old password with the new one.
For me, the following worked:
Do not use your GitLab password, but create an access token and use it instead of your password:
In GitLab, at the top-right corner, go to Personal Profile → Settings → Access Tokens Create a new personal access token (check the api option) git clone ... When you are asked for your password, copy and paste the access token instead of your GitLab password
You can try the following command:
git config --system --unset credential.helper
Then, enter a new password for Git remote server.
git config --global--unset credential.helper
sudo
if your user doesn't have access to /etc
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") After that use git command like 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...
git config --global --unset credential.helper
The only thing that worked for me was using https://username:Password@gitlab.com/user/projectgit
instead of https://gitlab.com/user/projectgit
. See https://gitlab.com/gitlab-com/support-forum/issues/1654
git remote set-url origin https://usernameHere:personalAccessTokenHere@gitlab.com/usernameHere/projectNameHere
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.
https://i.stack.imgur.com/JxDfZ.png
Just add your username before the domain:
https://**username**@gitlab.com/user/projectgit
And the assistant will ask you the password
I was also facing the same issue. The reason for the problem was authentication error. To solve this problem go to Control Panel -> Credential Manager -> Generic Credentials here find your gitlab credential and edit them. Make sure your ID password is right or not
https://i.stack.imgur.com/LLMTI.png
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
Kerberos
aren't necessary. Thanks! git-scm.com/docs/git-config
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.
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:
if the two-factor authentication is disabled, or
if you have special characters in your username or password, or
if you have a Git credential helper: git config credential.helper.
git config credential.helper
: that could have cached the wrong credentials.
Before digging into the solution lets first see why this happens.
Before any transaction with git that your machine does git checks for your authentication which can be done using
An SSH key token present in your machine and shared with git-repo(most preferred) OR Using your username/password (mostly used)
Why did this happen
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
Solution
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
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.
https://i.stack.imgur.com/iPLCC.png
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:
Goto https://gitlab.com/profile/personal_access_tokens Create new token and mark check to all. Copy your token Now go to your Terminal and paste it like this.
git clone https://oauth2:YOUR_TOKEN@gitlab.com/PROFILE_NAME/REPO_NAME.git/
<USERNAME>:<PERSONAL_TOKEN>@gitlab.com/<USERNAME>/<REPO_NAME>.git
works for me when configuring a "Mirroring Repository"
Open command prompt as administrator then run this command:
git config --system --unset credential.helper
Try this:
Go to: C:/Users/(YourUserName)/ Delete file .gitconfig
There are two ways I got around this problem:
I added my username to the front of the remote URL (https://username@gitRepoURL) Not always the best solution; where I work, even though we're slowly moving towards using GIT, we have our applications on a network drive, so if I do this, only I can push changes even if someone else worked on a feature. 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.
git config -l
. Also try above with --global
instead of --system
It is certainly a bug, ssh works with one of my machines but not the other. I solved it, follow these.
Generate an access token with never expire date, and select all the options available. Remove the existing SSH keys. Clone the repo with the https instead of ssh. Use the username but use the generated access token instead of password.
https://i.stack.imgur.com/MSeru.png
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
Same problem with Sourcetree On Mac
Solution: Delete the password in keychain access.
https://i.stack.imgur.com/LWVqV.png
When you try to push again it will ask for your password.
Go to Control Panel->Credential Manager->Windows Credentials select github or gitlab credentials and modify it. This is for windows10
i removed gitlab credential from 'Credential Manager' in windows and pushed successfully
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
For me it was some other git URL placed in config file, so I did change it manually:
Move to .git/config file and edit it, Remove invalid URL(if it's there) and paste the valid git SSH/HTTP URL like below way:
[remote "origin"]
url = git@gitlab.com:prat3ik/my-project.git
And it was working!!
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.
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 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
yourUserName@STAuth-gitlab.yourAdress
then tried to push and pull the code from the source tree and it worked.
You can also read the following answers:
For Mac user:
Go to keychain and delete gitlab accounts Go to your project path in terminal and simply type git pull Then you will be asked for username and password for gitlab Enter your username which you will find out in gitlab account in profile section. Then after that enter you updated password here. Here we go, again try to push your code, it may help you guys.
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!
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.
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.
Success story sharing