68

I recently reinstalled Windows and I have a problem with downloading files from repository.

I have installed GIT and Python, but when I am trying to download anything from Bitbucket I get the message:

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

What am I doing wrong?

рüффп
  • 4,475
  • 34
  • 62
  • 99
sunpietro
  • 1,798
  • 3
  • 22
  • 37

13 Answers13

118

I solved it setting a global parameter:

git config --global core.askpass /usr/libexec/git-core/git-gui--askpass
TLama
  • 71,521
  • 15
  • 192
  • 348
jsarroyo
  • 1,189
  • 2
  • 6
  • 2
  • This was very helpful on my PC, but I just installed git on my laptop (Win 8.1), and the command line asked me for the password with no need of your solution. Does anybody know why some installations don't need this solution? – min.yong.yoon Feb 05 '14 at 09:29
  • @min.yong.yoon this appears to be a git version issue. That might explain the difference you see – Spencer Stejskal Feb 05 '14 at 17:14
  • in my case git-core was just in usr/lib/ – Z. Zlatev May 14 '14 at 05:28
  • 4
    Thanks so much! If that command doesn't work, git-gui-askpass might be in a different location. I'm using cmder, so I ran this command: `git config --global core.askpass "C:\Program Files\cmder\vendor\msysgit\libexe c\git-core\git-gui--askpass"` – Ryan DeBeasi Aug 27 '14 at 19:13
  • 6
    if you have x64 windows and installed "git for windows" than this might helps `git config --global core.askpass "C:\Program Files (x86)\Git\libexec\git-core\git-gui--askp ass"` – Hitesh Chavda Dec 08 '14 at 13:19
  • 3
    I've got x64 git for windows and typed: `git config --global core.askpass "C:\Program Files\Git\\mingw64\libexec\git-core\git-gui--askpass"` – Markus Weber May 18 '17 at 06:57
  • open-ssh askpass works as well ```git config --global core.askpass /usr/bin/ssh-askpass``` – PST Sep 09 '17 at 07:30
65

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

git clone https://username:password@bitbucket.org/path_to/myRepo.git
рüффп
  • 4,475
  • 34
  • 62
  • 99
Yauheni Sivukha
  • 2,432
  • 19
  • 21
  • 1
    Instead of cloning again, you can also modify .git/config file to add your password into the url. However, it is not secure to leave your password in a plan config file though. – SXC Jan 15 '14 at 05:17
  • 7
    @SimonXinCheng Creating a SSH key and adding it to BitBucket is a really better solution than writing your password in plain text into the config file. – jordsti Jan 16 '14 at 16:36
  • 1
    btw: not secure at all – David 天宇 Wong Jul 17 '14 at 19:06
  • Needed this for testing scripts on a container, throwaway use once scenario – syclee Feb 17 '17 at 04:14
29

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!

James Pace
  • 567
  • 5
  • 13
12

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.

outofBounds
  • 555
  • 5
  • 18
9

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!

bbarke
  • 179
  • 12
  • +1 this described and fixed the issue for me too ... logging a bug on git site – Manse Jan 27 '14 at 16:27
  • +1 Thank you! If anyone is looking for the previous version, get it here: https://code.google.com/p/msysgit/downloads/detail?name=Git-1.8.4-preview20130916.exe&can=2&q= – Veelkoov Feb 06 '14 at 13:34
  • I've created an [unofficial fix release (1.8.5.4)](https://github.com/nevik/git/releases/tag/v1.8.5.4.msysgit.nevik.0) for people who want to or need to use a Git version newer than 1.8.4. This should serve as an intermediate solution until a new official release is made. – Nevik Rehnel Feb 09 '14 at 18:55
  • 2
    Git for windows 1.9.0-preview20140217 is now out, and I confirmed that it fixes this issue. – lyomi Feb 18 '14 at 07:33
4

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
PointZeroTwo
  • 1,502
  • 14
  • 15
3

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.

Artyom Pranovich
  • 6,344
  • 6
  • 33
  • 56
1

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.

Community
  • 1
  • 1
Slav
  • 628
  • 1
  • 16
  • 21
1

FIX IT (09/2020)

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

https://username:PASSWORD@Bitbucket.org

SOLUTION 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

derby
  • 61
  • 7
0

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.

Martin Staufcik
  • 5,801
  • 4
  • 32
  • 46
0

For me it was solved by taking of the 'private' switch from my bitbucket repository in the settings sections

Eelco van Vliet
  • 593
  • 5
  • 13
-1

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.

-2

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

Saurabh Kumar
  • 2,249
  • 6
  • 31
  • 48
  • 2
    Please don't post link-only answers to your own site. Instead, put the essential information in your answer itself. See: [**What signifies “Good” self promotion?**](http://meta.stackexchange.com/q/182212/200235) – durron597 Sep 11 '15 at 03:22
  • Link is dead, by the way. – wovano Aug 25 '20 at 13:50