Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

single-user command-line user of git on Linux; how to swtich to using these infernal API tokens?

ryancw
July 19, 2026

Hello. I have been completely flummoxed by this move from app passwords to API tokens. It seems I am not alone in that.

have been using only a tiny subset of git capabilities in my single-user workflow, but it's enough for me. So I"m a long-time but still inexperienced user.

I use git via command line on Linux Mint. I have my credentials stored. (Yes, I know, but I am the only person with physical access to my computers.) So to push and pull (really my only actions) I simply do::

git pull

or

git push

when in my project directory.

How do I switch that to use API tokens? Could someone please share the sequence of commands to:

forget my current credentials

store my token-based credentials

pull and push

Thank you very much.

3 answers

1 vote
ccenvcvb
Contributor
July 22, 2026

Why don't you use an ssh key ? 

steps

ssh-keygen
add generated pub key to your bitbucket account https://bitbucket.org/account/settings/ssh-keys/

use git@ urls instead of http urls for git clone

change existing remote urls with git remote command

see also, but I don't see the need for the ssh agent mentioned there
https://support.atlassian.com/bitbucket-cloud/docs/set-up-personal-ssh-keys-on-linux/

1 vote
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 20, 2026

Hi @ryancw 

I've responded to your comment on another post - you may view it at the link below :) 

Cheers!

- Ben (Bitbucket Cloud Support)

0 votes
Arkadiusz Wroblewski
Community Champion
July 19, 2026

Hello @ryancw 

Your credential.helper store will cache the new token automatically. Ensure it has both read:repository:bitbucket and write:repository:bitbucket scopes, then clear the old credentials by running:

printf "protocol=https\nhost=bitbucket.org\n\n" | git credential reject

Next, run git pull, enter your case-sensitive username, and paste the token as the password to save it. If that fails, you can force Atlassian's token auth by running git remote set-url origin https://x-bitbucket-api-token-auth@bitbucket.org/<workspace>/<repository>.git and pulling again, just don't put the actual token string in the URL.

Best,

Arek 🤠

ryancw
July 26, 2026

@Arkadiusz Wroblewski thank you so much! That was simple, and so far it seems to have worked.

rcw@rcw-lm203c:~/DATA/BookIdeas$ printf "protocol=https\nhost=bitbucket.org\n\n" | git credential reject
rcw@rcw-lm203c:~/DATA/BookIdeas$ git push
Password for 'https://ryancw@bitbucket.org':  #### I put in my API token ####
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 967 bytes | 967.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
To https://bitbucket.org/ryancw/bookideas.git
a501f4a..4600866 master -> master
rcw@rcw-lm203c:~/DATA/BookIdeas$ cd ../etm
rcw@rcw-lm203c:~/DATA/etm$ git status -uno
On branch master
Your branch is up to date with 'origin/master'.

I wasn't sure if I needed to run your one-liner afresh in every directory where I have a git-monitored project. I tried it in a different one, and git did not ask me to re-enter my password/token. So maybe not? Maybe entering it once changes the behavior globally?

Like Arkadiusz Wroblewski likes this
Arkadiusz Wroblewski
Community Champion
July 26, 2026

Exactly you only need to do this once.🤠

Because credential.helper store saves credentials globally in ~/.git-credentials, your new token automatically applies to all HTTPS Bitbucket repos using that username. You'll only be prompted again if the token expires, you switch to SSH, or you change usernames.

Just keep in mind that store saves tokens in plaintext on disk, a Linux keyring or Git Credential Manager is safer if you ever want to upgrade.

But you was using it before so I assume that's Trade-off you accepting.

Glad it's working! 🙂

Best,

Arek 🤠

ryancw
July 26, 2026

@Arkadiusz Wroblewski Fair point about the plain text. I'm not too worried, but if I *was* to tighten up my security, how do I make git stop storing my password/token, and to ask me for it every time I push or pull? That would not be a big burden, since I have it stored in linux pass, and can just do 

pass -c pass/path/to/my/token

and enter my key's passphrase when asked

to copy that long token string to the clipboard for 45 seconds.

Thanks again!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events