Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

pushing to bitbucket with app password

jerome shaolin April 2, 2022

since bitbucket started requiring the use of app passwords  I haven't been able to push commits there anymore and have been accumulating local commits, I want to resume pushing to bitbucket but can't find any documentation on how to use app password when using git push!!?

when I tried just entering the app password as the password git asks for I get  a 403 as follows: 

remote: Your credentials lack one or more required privilege scopes.

fatal: unable to access 'https://bitbucket.org/jeromesteam/willy2k.git/': The requested URL returned error: 403
how do solve this..?

3 answers

1 accepted

1 vote
Answer accepted
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 3, 2022

G'day Jerome!

We have documentation available for the change to instruct you on how to make usage of App Passwords:
https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231

Essentially, when connecting via HTTPS you will use your App Password alongside your username separated with a ":" character.

Therefore if you are authenticating to GIT over HTTPS to push/pull you will need to update your remote URL's to include the App Password:
git remote set-url origin https://USERNAME:APP_PASSWORD@bitbucket.org/username/reposlug.git
The same applies when performing git clone:
git clone https://USERNAME:APP_PASSWORD@bitbucket.org/username/reposlug.git
Hope this helps.
Cheers!
- Ben (Bitbucket Cloud Support)
jerome shaolin April 10, 2022

I tried your suggestion of  running  remote  set-url in the format you suggested but got:

fatal: unable to access 'https://https://*******@bitbucket.org/*******/*******.git/': Could not resolve host: bla bla.

jerome shaolin April 10, 2022

also couldn't find any help with this on the url you posted (which I read before asking my question) 

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 11, 2022

Hi @jerome shaolin

The output which you have provided is incorrect and shows the https protocol twice, hence the "unable to access" error - the commands should be as follows:

git remote set-url origin https://********:APP-PASSWORD-HERE@bitbucket.org/********/********.git

 Then when performing git clone it should look like this:

git clone https://********:APP-PASSWORD-HERE@bitbucket.org/********/********.git

If you encounter continued issues with HTTPS, I would recommend potentially authenticating with SSH instead, there is documentation located here:
https://support.atlassian.com/bitbucket-cloud/docs/set-up-an-ssh-key/

Cheers!

- Ben (Bitbucket Cloud Support)

jerome shaolin April 17, 2022

my best interpretation of your last answer resulted in this command:
git remote set-url origin MYAPPPASSWORD@https://*******@bitbucket.org/*******/********.git
which also failed (screenshot below) , i'm still unable to push local commits to bitbucket!

jerome shaolin April 17, 2022

my latest attempt was:
git remote set-url origin https://******:App_PASSWORD@bitbucket.org/*******/*******.git
and found myself back where I started!!? :-(

i.e. 

remote: Your credentials lack one or more required privilege scopes.

fatal: unable to access 'https://bitbucket.org/*******/*******.git/': The requested URL returned error: 403

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 18, 2022

Hey @jerome shaolin - the last command you have provided me is the correct format and should be the command that is entered to add that remote connection to the repo.

The error that you are receiving when trying to interface with the repo implies that you will need to check the App Password you have configured - it currently does not contain the necessary permissions granted to it to perform the task you are trying to accomplish.

Try creating a new App Password from within Personal Settings > Access Management: App Password and ticking all of the options for access (ie Read/Write/Admin). Once that has been done, then try running the remote command above again with the new App Password.

Once this is done - try to perform a clone/push and provide output if this does not work.
I would also suggest checking that there are no old passwords being cached in your system related to GIT (ie Windows Credential Manager, Mac Keychain Access) etc.

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

0 votes
gigafunk August 15, 2023

I have been at this for hours, wtf? maybe this is git standard and i am the idiot, but a mention of this fact on the app password page would be nice. hours of google searching for this information. maybe it in a video or tutorial,  but just a few words on the app password setup page would save alot of grief for us "know enough to hurt ourselves advanced newbs".

i said your product is stupid because this-

you cant login to web with app password, yet your stupid sourcetree, for oauth, wants to connect by logging into the web portal, which cant be done with an app password. if you do it with your main password, you cant push because its not the app password. ie STUPID

0 votes
samtse May 22, 2022

that worked - thx.. (though not sure why ? as I had checked everything necessary in the prior app password) 
wasted a lot of time. but ok now thx.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events