<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sahil Pacherwal</title>
    <description>The latest articles on DEV Community by Sahil Pacherwal (@sahil_pacherwal).</description>
    <link>https://dev.to/sahil_pacherwal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4131876%2F7352b6e7-076c-46e5-9651-409d70f50b5b.jpg</url>
      <title>DEV Community: Sahil Pacherwal</title>
      <link>https://dev.to/sahil_pacherwal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sahil_pacherwal"/>
    <language>en</language>
    <item>
      <title>Bitbucket API Token Keeps Asking for Credentials on Every Git Pull/Push? Here's the Fix</title>
      <dc:creator>Sahil Pacherwal</dc:creator>
      <pubDate>Fri, 18 Sep 2026 17:21:10 +0000</pubDate>
      <link>https://dev.to/sahil_pacherwal/bitbucket-api-token-keeps-asking-for-credentials-on-every-git-pullpush-heres-the-fix-fjc</link>
      <guid>https://dev.to/sahil_pacherwal/bitbucket-api-token-keeps-asking-for-credentials-on-every-git-pullpush-heres-the-fix-fjc</guid>
      <description>&lt;p&gt;Recently, I ran into an annoying authentication issue while migrating a Bitbucket repository from an &lt;strong&gt;App Password&lt;/strong&gt; to an &lt;strong&gt;API Token&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The migration itself was straightforward, but Git Credential Manager started prompting me for the API token on every &lt;code&gt;git pull&lt;/code&gt;, &lt;code&gt;git push&lt;/code&gt;, and &lt;code&gt;git fetch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The Git operation would eventually succeed, but I had to enter the token twice every time.&lt;/p&gt;

&lt;p&gt;Here's what happened and how I fixed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The original problem
&lt;/h2&gt;

&lt;p&gt;I was using Git Bash on Windows 11 with a Bitbucket Cloud repository accessed over HTTPS.&lt;/p&gt;

&lt;p&gt;My remote looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://&amp;lt;BITBUCKET_USERNAME&amp;gt;@bitbucket.org/&amp;lt;WORKSPACE&amp;gt;/&amp;lt;REPOSITORY&amp;gt;.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Previously, I was using a Bitbucket App Password and Git operations worked normally.&lt;/p&gt;

&lt;p&gt;After Bitbucket deprecated App Passwords, I created a Bitbucket API Token and replaced the old credential.&lt;/p&gt;

&lt;p&gt;The first time I tried:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I received:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fatal: Invalid credentials
remote: CHANGE-3222 - Functionality has been deprecated
remote: App passwords are deprecated and must be replaced with API tokens.
remote: https://developer.atlassian.com/cloud/bitbucket/changelog#CHANGE-3222
fatal: unable to access 'https://bitbucket.org/&amp;lt;WORKSPACE&amp;gt;/&amp;lt;REPOSITORY&amp;gt;.git': The requested URL returned error: 410
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So I created a new API Token with the required repository permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The strange authentication behavior
&lt;/h2&gt;

&lt;p&gt;After configuring the API Token, Git authentication started working, but there was a new problem.&lt;/p&gt;

&lt;p&gt;Every Git operation followed this pattern:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A Bitbucket Login popup appeared.&lt;/li&gt;
&lt;li&gt;My Bitbucket username was already populated.&lt;/li&gt;
&lt;li&gt;I entered the API Token as the password.&lt;/li&gt;
&lt;li&gt;After clicking Continue, another password prompt appeared:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Password for 'https://&amp;lt;BITBUCKET_USERNAME&amp;gt;@bitbucket.org':
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;I entered the same API Token again.&lt;/li&gt;
&lt;li&gt;The Git operation succeeded.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So authentication worked, but I had to provide the token twice.&lt;/p&gt;

&lt;p&gt;And this happened on every:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull
git push
git fetch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  My environment
&lt;/h2&gt;

&lt;p&gt;The setup was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows 11&lt;/li&gt;
&lt;li&gt;Git Bash&lt;/li&gt;
&lt;li&gt;Git for Windows&lt;/li&gt;
&lt;li&gt;Bitbucket Cloud&lt;/li&gt;
&lt;li&gt;HTTPS Git remote&lt;/li&gt;
&lt;li&gt;Git Credential Manager&lt;/li&gt;
&lt;li&gt;Bitbucket API Token&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My Git configuration included:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.helper manager
git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.bitbucketAuthModes basic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also checked Windows Credential Manager and found Bitbucket credentials there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Things I tried
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Clearing Windows Credential Manager
&lt;/h3&gt;

&lt;p&gt;I removed the existing Bitbucket credentials from:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Control Panel → Credential Manager → Windows Credentials&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Specifically, I removed the entries associated with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git:https://bitbucket.org
git:https://&amp;lt;BITBUCKET_USERNAME&amp;gt;@bitbucket.org
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then tried the Git operation again.&lt;/p&gt;

&lt;p&gt;The same behavior occurred.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Checking Git Credential Manager configuration
&lt;/h3&gt;

&lt;p&gt;I verified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; &lt;span class="nt"&gt;--get&lt;/span&gt; credential.bitbucketAuthModes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;basic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also confirmed that Git Credential Manager was configured:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; &lt;span class="nt"&gt;--get&lt;/span&gt; credential.helper
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;which returned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;manager
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The actual solution
&lt;/h2&gt;

&lt;p&gt;The configuration that finally fixed the problem was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.bitbucketValidateStoredCredentials &lt;span class="nb"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then removed the existing Bitbucket credentials from Windows Credential Manager one more time.&lt;/p&gt;

&lt;p&gt;After that, I ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and entered:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Username: &amp;lt;BITBUCKET_USERNAME&amp;gt;
Password: &amp;lt;BITBUCKET_API_TOKEN&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The credential was then stored correctly.&lt;/p&gt;

&lt;p&gt;Afterward, these commands worked without asking for the token again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull
git push
git fetch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final configuration
&lt;/h2&gt;

&lt;p&gt;My relevant Git configuration is now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;credential.helper=manager
credential.bitbucketAuthModes=basic
credential.bitbucketValidateStoredCredentials=false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check it with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; &lt;span class="nt"&gt;--list&lt;/span&gt; | &lt;span class="nb"&gt;grep &lt;/span&gt;credential
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important setting is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.bitbucketValidateStoredCredentials &lt;span class="nb"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why was this confusing?
&lt;/h2&gt;

&lt;p&gt;The confusing part was that the API Token itself was valid.&lt;/p&gt;

&lt;p&gt;The Git operation eventually succeeded when I entered the token in the second prompt.&lt;/p&gt;

&lt;p&gt;So this wasn't a simple case of:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The API token is invalid."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The problem was related to how Git Credential Manager was validating/storing the Bitbucket credential.&lt;/p&gt;

&lt;p&gt;Git Credential Manager's Bitbucket authentication flow can validate stored credentials against Bitbucket. In this case, that validation behavior was causing the credential to be requested again even though the token was valid for the Git operation.&lt;/p&gt;

&lt;p&gt;Disabling stored credential validation allowed Git Credential Manager to use the stored credential directly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final takeaway
&lt;/h2&gt;

&lt;p&gt;The migration from Bitbucket App Passwords to API Tokens worked, but Git Credential Manager was repeatedly asking for credentials even though the API Token was valid.&lt;/p&gt;

&lt;p&gt;The configuration that resolved the problem for me was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.bitbucketValidateStoredCredentials &lt;span class="nb"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Combined with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.helper manager
git config &lt;span class="nt"&gt;--global&lt;/span&gt; credential.bitbucketAuthModes basic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After clearing the old Bitbucket credentials from Windows Credential Manager, Git was finally able to reuse the stored credential.&lt;/p&gt;

&lt;p&gt;No more repeated API Token prompts. 🎉&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This is a workaround that resolved the issue in my environment. It should not be interpreted as an official recommendation from Atlassian to disable credential validation.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Bitbucket API Tokens documentation: &lt;a href="https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/" rel="noopener noreferrer"&gt;https://support.atlassian.com/bitbucket-cloud/docs/using-api-tokens/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Git Credential Manager Bitbucket authentication: &lt;a href="https://github.com/git-ecosystem/git-credential-manager/blob/main/docs/bitbucket-authentication.md" rel="noopener noreferrer"&gt;https://github.com/git-ecosystem/git-credential-manager/blob/main/docs/bitbucket-authentication.md&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Bitbucket App Password deprecation: &lt;a href="https://developer.atlassian.com/cloud/bitbucket/changelog/" rel="noopener noreferrer"&gt;https://developer.atlassian.com/cloud/bitbucket/changelog/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>bitbucket</category>
      <category>gitcredentialmanager</category>
      <category>windows11</category>
    </item>
  </channel>
</rss>
