Windows git access denied

HTTP Basic: доступ запрещен, фатальный: аутентификация не удалась

Я использую GitLab Community Edition 9.1.3 2e4e522 на Windows 10 Pro x64. С клиентом Git.

Как это исправить?

12 ответов

Откройте команду типа CMD (Запуск от имени администратора):

Затем введите новый пароль для удаленного сервера Git.

Для моего случая я сначала попробовал с

git config —system —unset credential.helper

Но я получаю ошибку

ошибка: не удалось заблокировать файл конфигурации C: / Program Files / Git / etc / gitconfig: В доступе отказано

Потом попробовал с

git config —global —unset credential.helper

Нет ошибки, но все равно получил ошибку «Отказано в доступе» во время git pull.

Затем перейдите в Панель управления -> Диспетчер учетных данных> Учетные данные Windows и удалите учетную запись git.

После этого, когда я снова попробовал git pull, он запросил учетные данные и добавил новую учетную запись git в диспетчере Credentails.

Я справился с той же ошибкой, и мое предложение:

  1. Начните с попытки собрать другого пользователя в git lab
  2. Перепроверьте имя пользователя и пароль (хотя это звучит очевидно)
  3. Проверьте учетные данные Windows (начало -> «кредит»)
  4. Скопируйте и вставьте тот же URL, который вы получили в git lab, структура должна быть:
  1. Перепроверьте авторизацию в GitLab
  2. Обратите внимание на регистр символов

Надеюсь, что одно из вышеперечисленного решит это.

В моем случае я использовал Git Credential Manager для Windows (он был установлен по умолчанию, я не устанавливал его вручную)

Диспетчер учетных данных сохранил мой старый пароль, но я недавно изменил его.

Если вы находитесь в тех же условиях, чтобы решить эту проблему: Перейдите в Панель управления -> Диспетчер учетных данных и удалите учетную запись git. После этого он снова запросит учетные данные.

Отредактируйте запись (возможно, поле пароля, которое могло измениться) для git: в разделе «Общие учетные данные» учетных данных Windows, к которому можно получить доступ через панель управления. Обратите внимание, что это для ОС Windows.

Когда он просит имя пользователя и пароль. Просто добавьте имя пользователя gitlab и пароль для клонирования. Чтобы появилось окно с запросом учетных данных, сделайте следующее:

Перейдите в «панель управления» -> учетные записи пользователей -> управлять учетными данными-> учетные данные Windows-> git: https: //username@gitlab.com-> нажмите стрелку вниз->, а затем нажмите удалить.

Надеюсь это поможет!

  • Попробуйте, если это работает на Git Bash
  • Вы добавили ключ ssh в свой аккаунт? Если да, удалите его и попробуйте снова. Если не добавить один и попробуйте URL-адрес SSH.
  • Вам не обязательно нужен Git Tortoise, но он также может обойти вашу проблему
  • Попробуйте переустановить Git без Git Credential Manager для Windows

Когда вы исправите проблему push, вы также сможете ее клонировать, если она частная или внутренняя.

Это может также произойти из-за изменения пароля и того, что Git Credential Manager кеширует его, поэтому в этом случае 1. Откройте диспетчер учетных данных в Windows 2. Найдите свои учетные данные GIT и сбросьте их на новый пароль.

Зайдите в диспетчер учетных данных => учетные данные git Проверьте свои учетные данные git и проверьте свой пароль.

Это сработало для меня.

Простая команда git fetch / pull выдаст сообщение об ошибке аутентификации. Но выполните ту же команду git fetch / pull во второй раз, и она должна отобразить окно с запросом учетных данных (имя пользователя / пароль). Введите свой идентификатор и новый пароль, и он должен сохраниться и двигаться дальше.

Я использую VS Code на моей Mac OS и GitLab для моего проекта. Я пробовал так много способов, но это сработало просто для меня, сбросив удаленный источник вашего репозитория проекта с помощью следующей команды:

Надеюсь, это кому-нибудь поможет.

Откройте команду типа CMD (Запуск от имени администратора):

Затем введите имя пользователя и пароль для удаленного сервера Git.

Access denied to file on windows 7 for Administrator account

I want to delete my git repository (.git folder) created by git on my windows 7 box. It says access denied to .git/refs/header folder.

Читайте также:  Сохранение паролей для windows 10

I open a console with Administrator role, issue command «takeown /F heads /A /R», it still says «ERROR: Access is denied.», neither can i do via GUI security dialog.

1 Answer 1

An access denied error may mean the file is in use by another process and, for a GIT repository, that seems more likely than a file permissions issue.

(I’m assuming GIT is like SVN where every file in the repository is created by your own account with standard permissions. If that’s not the case then I may be wrong.)

As a first step, run Process Explorer as Administrator and push Ctrl-F to open a window where you can type the filename and see which processes (if any) have that file open.

When I say «run as Administrator»:

I don’t just mean when logged in as Administrator. Windows 7’s UAC means Administrator accounts don’t run things with full admin access by default. Right-click procmon.exe and choose the «Run as Administrator» option.

I assume you’re already familiar with this from running the command prompt as admin. If you just changed to an admin account, but didn’t use «Run as Administrator» on the command prompt, then that could be why the takeown command failed. The command prompt should say «Administrator:» in its window title if it is properly elevated, unless UAC is off entirely.

If one or more processes are listed, confirm the full file path in the list (in case some other file on disk has a similar name).

Close any processes which have the file open. Try to close them normally if you can. As a last resort you can end-task them. If it’s a process running as another user/account, it might be a service which you can stop.

(Ensure View->Show Processes for All Users is ticked, then find the process in question via the PID column. If you think it’s a service, hover the mouse over it and a tooltip will appear telling you the name(s) of any services it is running.)

If you cannot find any process accessing the file, or closing them all still results in an access denied error, and you are definitely trying the deletion from an elevated command prompt, then you might want to try telling Windows to delete the file the next time it is rebooted. You can use the SysInternals MoveFile tool for that.

How to solve Access denied in gitlab?

When I run : git push , there is exist error like this :

Is there any people who can help me?

8 Answers 8

You need to add an SSH key to your GitLab and make sure git is using that key.

You can find this documentation helpful.

For Windows users, check this unbelievable easy solution, which works for me:

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.

then enter new password for Git remote server.

For Windows User

Go to Control Panel->Credential Manager->Windows Credentials select github or gitlab credentials and modify it. This is for windows10

Update your credentials again

and add access token here

if you made your account by signing in with Github or Bitbucket, etc. add a password to your account so you can push, pull and clone with Gitlab.

Very late here, but for posterity’s sake:

If you do not have a gitlab password (initially signed up through github or something), then this will fail. You will just need to go to the page and create a password. At least that worked for me.

This happened to me today. First was a blue screen of death in Windows 10 (I’m using git for windows connecting to a Azure DevOps repo), so after a restart, I was able to run git status and git diff both were fine, and then git add . that was also fine. When I got to git push I got an error unable to access.

I had cloned the repo and used the supplied git credentials initially and didn’t have to enter any more credentials. So, I tried git remote -v and it listed the remote repo. After this I tried git push again, and It worked. An easy one to try before you go more difficult routes.

Читайте также:  Консультант плюс приложение для windows

Basic Authentication / Access Denied issue fix:

Open Terminal from respect tool (Ex: Source Tree)

Execute this command —> git config —global credential.helper store

Execute this command —> git pull

i) provide your user name 2) provide your password

HTTP Basic: Access denied fatal: Authentication failed

I use GitLab Community Edition 9.1.3 2e4e522 on Windows 10 Pro x64. With Git client.

14 Answers 14

Open CMD (Run as administrator) type command:

then enter new password for Git remote server.

Im my case i was using Git Credential Manager for Windows (it was installed by default, I didn’t install it manually)

Credentials Manager had saved my old password but i changed it lately.

If you are in the same conditions, to solve this problem: Go to Control Panel -> Credentials Manager and delete git account. After that it will ask you again for the credentials.

For my case, I initially tried with

git config —system —unset credential.helper

But I was getting error

error: could not lock config file C:/Program Files/Git/etc/gitconfig: Permission denied

Then tried with

git config —global —unset credential.helper

No error, but still got access denied error while git pulling.

Then went to Control Panel -> Credentials Manager > Windows Credential and deleted git account.

After that when I tried git pull again, it asked for the credentials and a new git account added in Credentails manager.

i coped with same error and my suggestion are:

  1. Start with try build another user in git lab
  2. Recheck username & password (although it sounds obvious)
  3. Validate the windows cerdential (start -> «cred»)
  4. Copy & paste same URL like you get from git lab, the struct should be:
  1. Recheck the authorization in GitLab
  2. Give an attention to case sensitive

Hope one of the above will solve it.

This can happen also because of a change in the password and since Git Credential Manager caches it, so if that’s the case 1. Open Credential Manager in Windows 2. Search for your GIT credential and reset it to the new password.

When it asks for username and password. Just add gitlab user name and password for clonning. For the box to pop up asking credentials, do the following:

go to «control panel»-> user accounts-> manage credentials->windows credentials->git:https://username@gitlab.com->click on down arrow-> then click remove.

Hope this helps!

Go to your Credential manager => git credentials Check your git credentials and check your password.

This worked for me.

A simple git fetch/pull command will throw a authentication failed message. But do the same git fetch/pull command second time, and it should prompt a window asking for credential(username/password). Enter your Id and new password and it should save and move on.

I use VS Code on my mac OS and GitLab for my project. I tried so many ways but it worked simply for me by resetting the remote origin of your project repository with the below command:

Hope it helps someone.

Edit the entry(possibly the password field that may have changed) for git: inside Generic Credentials section of Windows Credentials which can be accessed from Control Panel. Please note this is for Windows OS.

  1. Generate an access token with never expire date, and select all the options available.
  2. Remove the existing SSH keys.
  3. Clone the repo with the https instead of ssh.
  4. Use the username but use the generated access token instead of password.

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

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

  1. An SSH key token present in your machine and shared with git-repo(most preferred) OR
  2. 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.

Читайте также:  Как ускорить загрузку windows с флешки

There you go this works with mostly every that windows keep track off

GitLab remote: HTTP Basic: Access denied and fatal Authentication

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

I am prompted to enter my GitLab username and password. After password is entered I get:

41 Answers 41

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)

  • Edit the git entry under Windows Credentials, replacing old password with the new one.
  • then enter new password for Git remote server.

    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.

    For me, the following worked:

    Do not use your GitLab password, but create an access token and use it instead of your password:

    1. In GitLab, go to: (Right corner) Personal Profile -> Settings -> Access Tokens
    1. Create a new personal access token (check api)
    1. git clone .
    2. When you are asked for your password, copy and paste the access token instead of your GitLab password

    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

    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.

    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

    Just add your username before the domain:

    And the assistant will ask you the password

    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

    1. Go to: C:/Users/(YourUserName)/
    2. Delete file .gitconfig

    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:-

    After running above command it asks me again my updated username and password.

    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 .

    Open command prompt as administrator then run this command:

    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.
    Оцените статью