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

How can I Upload entire directory to bitbucket repo via cloud API

Hello, I have an existing repo and would like to add an entire directory to it.

I am following this from the docs: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-source/#api-repositories-workspace-repo-slug-src-post

I am successfully able to add a single file with the following request:

curl --user $user:$password \
 -X POST https://api.bitbucket.org/2.0/repositories/$workspace/$repo_name/src \
 -F helloworld.txt=@helloworld.txt
Now lets say I had a directory named "mydir" which had multiple files inside it, Is there a way I can upload that entire directory, or the contents of the directory with one API call?

2 answers

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Feb 01, 2023

Hey Andre,

Unfortunately, wget/cURL does not have the concept of what a "folder" is in this context.

They can be used to upload individual files as you have stated - but they are unable to upload entire folders in a singular command.

You would need to write a bash script to cycle through each individual file in that directory to achieve what you wish to do.

Cheers!

- Ben (Bitbucket Cloud Support)

0 votes
Ulrich Kuhnhardt _IzymesCo_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Feb 01, 2023

Hi Andre,

first thing that comes to mind is to use git add, git commit and git push to add a directory to a BB repository. The commands can run as a script if you need to automate. However I'm not sure about your specific use-case.

Best, Ulrich

// Izymes

Suggest an answer

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

Atlassian Community Events