adimit19
asked on
CURL GET Raw File from BitBucket Repository with security
I am trying to get a raw file from a bitbucket repository using curl with the following commands:
curl -L -O https://user:password@bitbucket.org/username/repository/branch/HEAD/filename.txt
curl -L -O https://user:password@bitbucket.org/username/repository/branch/raw/filename.txt
I have a file committed to the master branch called filename.txt
I want to get the raw version of the above file. What code do i need to get that? All I get from these commands is the HTML code that the page contains
curl -L -O https://user:password@bitbucket.org/username/repository/branch/HEAD/filename.txt
curl -L -O https://user:password@bitbucket.org/username/repository/branch/raw/filename.txt
I have a file committed to the master branch called filename.txt
I want to get the raw version of the above file. What code do i need to get that? All I get from these commands is the HTML code that the page contains
ASKER
I can't use --digest --user <username>:<password>. The security info has to be in the https URL because I will be using that URL in another application. I am simply testing it with CURL first.
According to BitBucket docs, here's how you can use curl...
https://developer.atlassia n.com/serv er/bitbuck et/how-tos /example-b asic-authe ntication/
You are correct. You must use the REST API for BitBucket access.
Highly unlikely BitBucket allows URL embedded user/pass credentials, as Apache retired this facility years ago.
https://developer.atlassia
You are correct. You must use the REST API for BitBucket access.
Highly unlikely BitBucket allows URL embedded user/pass credentials, as Apache retired this facility years ago.
Why curl? Is the repo so big that you do not want to use git?
ASKER
Hello David/shaun
David: The syntax works except I can't get the raw format of a single file.
Both: I was hoping to use something like filename.txt?raw instead of the commit key or raw url. I really only need the raw version of a single file and I am stuck on that.
Shaun: I can use git or curl, makes no difference to me. In the end this command will go into another application. Typically the curl command uses the syntax supported by the particular feature in the 3rd party app that I am using.
David: The syntax works except I can't get the raw format of a single file.
Both: I was hoping to use something like filename.txt?raw instead of the commit key or raw url. I really only need the raw version of a single file and I am stuck on that.
Shaun: I can use git or curl, makes no difference to me. In the end this command will go into another application. Typically the curl command uses the syntax supported by the particular feature in the 3rd party app that I am using.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You'll use something similar to this...
Open in new window
The exact form will vary slightly depending on exactly how your repository is setup. Also whether your repository is public/private.
Might be easier to setup an ssh key with an empty passphrase for your repository access.