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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,529
Community Members
 
Community Events
184
Community Groups

How to use access tokens for pull and push code to bitbucket

Edited
Sudhansu_Sahoo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Apr 16, 2023

Hi,

I created an access token with all permission.

Now I want to use it to push and pull code from bitbucket.

I tried using api: I was not able to push folders with it.

thatswhy I used gitpython to do the operations, but it is not asking for access token while pulling and pushing code.

 

I do not use pipelines for this, just normal repositories

Can someone suggest me a workaround for this

1 answer

0 votes
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 18, 2023

Hi @Sudhansu_Sahoo,

Welcome to the community.

Could you confirm which Access token you're currently using? - https://support.atlassian.com/bitbucket-cloud/docs/access-tokens/

Also, you mentioned you've tried using it against an API but you were not able to push folders with it.
Could you share the API endpoint you're using and the error message you're getting when you've tried that?

Regards,
Mark C

Sudhansu_Sahoo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Apr 19, 2023 • edited May 16, 2023

Hi @Mark C ,

Thank you for your response.

 

This is the endpoint i am using: 

* https://api.bitbucket.org/2.0/repositories/godigit/pyops-test-project/src/

here is the data i am sending to the api:

payload = {}
files=[
  ('file.txt',('file.txt',open('/D:/Requirement/pyops_validator/test_folder/new_folder/file.txt','rb'),'text/plain'))
]
headers = {
  'Accept''application/x-www-form-urlencoded',
  'Content-Type''application/x-www-form-urlencoded',
  'Authorization''Bearer <Access token>'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 16, 2023

Hi @Sudhansu_Sahoo

Could you try to do a CURL command instead and see if it works for you?

You can check some sample CURL commands from this link.

Regards,
Mark C

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events