Reputation: 2495
I am trying to make a script which get the repository from bitbucket and upload it to my ftp server.
My first problem is that i dont know how to get the repository.. Is there a way to download it with the official Bitbucket API? Or should i make a temporary folder and download it with git console?
Greez
Upvotes: 0
Views: 2933
Reputation: 2621
The accepted answer does not use the Bitbucket API how the OP asked. For anyone else actually looking to use the API I hope this helps.
To download the repo you just need to make a GET request at:
https://bitbucket.org/<account>/<repo>/get/<branch>.<zip|gz|bz2>
This call requires Basic Auth, so make sure to pass that header with your username and password.
You could also pass the username and password in the url using this format:
https://username:[email protected]/<account>/<repo>/get/<branch>.<zip|gz|bz2>
(Not all platforms support this format)
Upvotes: 4
Reputation: 2492
If I interpreted your question correctly, you just need to:
ssh-keygen -t rsa -b 4096 -C "$(whoami)@$(hostname)-$(date -I)"
)You should be set - the SSH key is a direct translation of your "Bitbucket API" request, if I got the question correctly.
Edit: Just make sure that you use the correct notation for the push and pull (it is different when you use HTTPS or SSH, notably you access the URL with [email protected]:<username>/<reponame>.git
)
Upvotes: 0