Error encountered while pushing to the remote repository
Asked by Paul Hartness:

I'm no longer able to push changes from my local git repository to bitbucket. I'm using Visual Studio to integrate to bitbucket and I get the following error

Failed to push to the remote repository. See the Output window for more details.  
Pushing master  
Error encountered while pushing to the remote repository: Git failed with a fatal error.  
Git failed with a fatal error.  
Invalid credentials  
Logon failed, use ctrl+c to cancel basic credential prompt.  
cannot spawn /c/program files (x86)/microsoft visual studio/2019/community/common7/ide/commonextensions/microsoft/teamfoundation/team explorer/Git/mingw32/libexec/git-core/git-askpass.exe: No such file or directory  
could not read Password for 'https://\<username\>@bitbucket.org': terminal prompts disabled

My credentials have not changed not has my password its just stopped working. I know there has been some update that requires some kind of change my side so I tried creating an App Password this created a label and password which I tried to use to log in and push my code but the error was the same. Any idea how I'm supposed to get this to work?


Answers:
author: bmurphy001
body: I had the same problem. This is what I did to fix it:

1. Create a Bitbucket application password as described here and record it. <https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/>
2. Ignore the instructions on how to add the password to Visual Studio.
3. In Visual Studio, try to push one of your repos to the remote site.
4. When prompted for log in credentials, enter your user name, NOT your email, and the application password.
5. Click yes, authorize, etc. in all additional windows or web pages that pop up to authorize the push.
6. After you have done this once successfully, pushing other repos should function normally.

comments: author: riccardo proietti
body: works for me


author: raghavirecwise
body: worked for me too. Thank You


author: ccs
body: I incurred the same issue today within Visual Studio 2019. Although, I was well aware this would happen, given Atlassian's notice stating "*Beginning March 1, 2022, you will no longer be able to use your Atlassian account password when using Basic authentication with the Bitbucket API or Git over HTTPS.* "  

To solve the issue, I accessed the **Credential Manager** , using windows search bar, and clicked on **Windows Credentials** icon. Under **Generic Credentials** section, I selected git:<https://bitbucket.org> which in turn expanded the item and allowed for me to click **Edit.** This is where I changed the password to my**App Password** .   
After clicking save, I did the same for the other Generic Credentials shown in the list related to my Bitbucket user url, e.g. git:<https://myuser1@bitbucket.org>.   
Afterwards, I restarted the computer just in case.   

Then, I opened my Visual Studio project and initiated a push request under Git Changes tab. A blue popup appeared, requiring OAuth verification. After I clicked the button titled *Verify,* I was directed to a browser page asking me to "Confirm access to your account" "**Sourcetree for Windows** **is requesting access to the following** " \[ref 1st image\].  

After clicking the **Grant Access** button, I was redirected strangely to a localhost address.  
This was prevented due to browser settings, which automatically redirected to https \[ref image 2\]. Therefore, I needed to copy that localhost address into a new incognito window and kaboom! it work. I was greeted with a verification approved message and was able to initiate Git request from Visual Studio again.  

![git_1.png](https://community.atlassian.com/t5/image/serverpage/image-id/187727iFD32976746A8C253/image-size/large?v=v2&px=999 "git_1.png")![git_2.png](https://community.atlassian.com/t5/image/serverpage/image-id/187728i251A835A1FC19409/image-size/large?v=v2&px=999 "git_2.png")  


author: Istvan Piroska
body: Great Job Atlassian..

How to broke a working system from one moment to another without a proper fix and waste developers time.


author: Theodora Boudale
body: Hi Paul,

An app password should be used in combination with your Bitbucket username, not with the label of the app password.  
You can find your Bitbucket username here: <https://bitbucket.org/account/settings/>

I would recommend first testing the operation (git push) from a terminal application:  
- Are you asked for a password when you try to push from terminal?  
- If so, are you able to push when you provide the app password?

If you are not asked for a password, then a credential manager is used locally. I would suggest removing any stored credentials for bitbucket.org from the credential manager, and then try again.

With regards to Visual Studio, I would also suggest checking if your authentication details for Bitbucket are stored in some configuration settings. If so, I would suggest removing them and replacing them with your Bitbucket username + app password.

Kind regards,  
Theodora


Tags: atl-gruland

bitbucket-cloud

cloud