Search code examples
gitazurebitbucketbitbucket-cloud

Cloning BitBucket repo using password in git clone command causes issue


I am trying to use the password in my git clone command to clone the repo but it always ends up with this error:

remote: Login failed due to incorrect login credentials or method.
remote: If you are unsure of which login details or login method to use, visit:
remote: https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/
fatal: Authentication failed for 'http://bitbucket.org/qhluo123/ceye-admin.git/'

Here is my clone command:

git clone http://username:[email protected]/qhluo123/ceye-admin.git

I can not use ssh or the pop-up method for the password as I am working on automatically cloning and deploying the repo on a remote system. None of the inputs are possible by the user side during the process. Is there any way I could solve this issue?

Adding SSH is not a solution as I am deploying it in the ARM template for Microsoft and the ARM template always creates a new VM.


Solution

  • Try to use an HTTPS access token instead of your account password.

    Most remote Git repository hosting services (GitHub, GitLab, Bitbucket) use tokens as password.

    It is also best to use a Git Credential helper, like, as per Azure documentation, the Git Credential Manager which comes with Git For Windows.
    That way, you do not have to use in plain-text URL your token.

    In your case, since the clone is don on a remote deploy ARM server, that might not apply, but using a token instead of a password remains the recommended option.