Bitbucket、 Windows 和“致命: 无法读取密码”

我最近重新安装了 Windows,我在从存储库下载文件时遇到了问题。

我已经安装了 GIT 和 Python,但是当我试图从 Bitbucket 下载任何东西时,我得到的信息是:

"fatal: could not read Password for: 'https://username@bitbucket.org': No such file or directory".

我做错了什么?

97656 次浏览

I had the same problem an hour or so ago. My issue was that I was trying to do a git clone but using the https url instead of the ssh one. If you go to your repository you can select ssh or https from the dropdown for the clone url. Hope that helps!

Try to include your username and password in the URL like this:

git clone https://username:password@bitbucket.org/path_to/myRepo.git

For https connections try installing the "Git Credential Store" (an "optional" step in the BitBucket tutorial).

This is how to install it:

  1. Download git-credential-winstore.exe from http://gitcredentialstore.codeplex.com/
  2. Open the Git Bash Shell and change the current directory to where git-credential-winstore.exe is located
  3. Run ./git-credential-winstore -i /bin/git

I just tried to do the same thing and it did not work for me, and I too recently reinstalled windows on my machine.

I am used to checking out a private repo from my bitbucket account by using the simple command git clone https://username@bitbucket.org/username/repo.git and then being prompted to enter a password for my user.

It looks like this might be broken in version 1.8.5.2. I downgraded to version 1.8.4 and it started working as expected.

Git download list: http://code.google.com/p/msysgit/downloads/list

Hope this helps!

I solved it setting a global parameter:

git config --global core.askpass /usr/libexec/git-core/git-gui--askpass

Just solved this Problem

Git in Version 1.8.5.2 contains a but using bitbucket, updating my Git to Version 1.9.0 solved this problem.

I got this issue when I upgraded from Windows 7 to 8 and settings messed up for me too. I had to regenerate private and public keys, and change my TortoiseGIT to use plink, instead of SSH.exe

I wrote step by step instructions at http://techblog.saurabhkumar.com/2015/09/using-tortoisegit-on-windows-with.html

Try to use git fetch in order to reenter and update the outdated password.

I had the similar issue. The cached password become invalid due to updating the actual password to new one. But git didn't ask me for reentering the valid password and just gave me an error that Authentication failed while I was trying to pull changes.

But magically, git asked me for the actual password when I typed git fetch instead of pulling the data. Once I entered the new password, apparently git updated the old one in its credentials storage and no longer asked me about the entering password again.

In my case, the problem was with the global file .gitconfig on Windows.

When I tried to use solution provided by @jsarroyo in Git BASH, I got an error saying that the file .gitconfig.lock did not exist. I could find no way to fix it.

When I completely removed .gitconfig, everything worked fine.

WARNING: This way, you lose all your git settings and you need to configure it again.

In my case, it was just a wrong password for bitbucket entered into the prompt dialog. When I entered the correct password, the error disappeared.

For Bitbucket If you are ok for the repo to be public you can just uncheck the "This is a private repository" checkbox in repo settings. Now a simple git clone should work.

FIX IT (09/2020)

All the the answers here are wrong... You shouldn't NEVER do something like that:

https://username:PASSWORD@Bitbucket.org

All you have to do is:

  • Go to Sourcetree -> Preferences -> Git
  • You will have the section "Git Version" with 2 options: Reset to ebedded Git and Use System Git

Sourcetree use the Ebedded git for default. Click on "Use System Git" and.... Fixed!


Follow me on: GIthub Twitter

In your project go to .git/config and add after username :password

before : https://username@bitbucket.org/repo.git

afetr : https://username:password@bitbucket.org/repo.git

If you are using android studio you might want to try enabling "Use credential helper".

Steps:

  1. Go to File -> Settings -> Version control -> Git
  2. Find "Use credential helper" option (mostly at bottom)
  3. Enable this option by marking the checkbox before the option

I had the same problem with the Android Studio Chipmunk 2021.2.1 Patch 2 integrated version control. Additionally I have BitBucket and GitHub ssh keys setup on my Windows PC. I was able to fix the issue by setting checked Use credential helper in File | Settings | Version Control | Git

enter image description here