annotate README.md @ 0:507ba2547208 default tip

Initial commit
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 30 Jun 2020 15:52:36 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
1 # Bitbucket backup
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
2
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
3 These repo contains a few scripts to help with cloning repositories from bitbucket.org. They were created in a hurry mostly by copy paste so please make sure that they actually download everything you need.
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
4
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
5 ## Using the API
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
6 ATTENTION! The user script will not download all folders visible when visiting the Bitbucket site, as that list is not availably through the API. If you want to download all repositories that you have access to please read below.
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
7
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
8 `./download_team_repos user team` will download all repos for a team
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
9 `./download_user_repos user` will download all repos owned by a user
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
10
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
11 The scripts use your password to access the API and clones the repositories through SSH. Therefore you will need to have your ssh-keys set up with your Bitbucket account.
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
12
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
13 ## Downloading all repos
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
14 There is no API endpoint for listing all repositories a user has access to. Therefore you will need to create a list of the repositories manually. There are two steps to this method, creating the list of repos, and using a script to clone all the repos in the list.s
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
15
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
16 ### Creating the list
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
17
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
18 The file should look something like
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
19 ```
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
20 /sbpteam/flexural_applications
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
21 /sbpteam/flexural_package
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
22 /werpers/pade_time
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
23 /sbpteam/laplace1d
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
24 /fwerpers/rankings
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
25 ```
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
26
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
27 I created my list by doing "Inspect element" in the browser for each of the pages under https://bitbucket.org/dashboard/repositories and copying the HTML into a text file. Then looking for links of the type `<a href="/sbpteam/pade_time">` and copying them to their own text file. If you have very few repos it might be faster to just right click the links on the page and doing "Copy link".
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
28
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
29 ### Running the script
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
30 When you have the list of repos you can run
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
31 ```bash
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
32 ./download_from_list.sh repolist.txt targetdir
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
33 ```
507ba2547208 Initial commit
Jonatan Werpers <jonatan@werpers.com>
parents:
diff changeset
34 where `repolist.txt` is your file with repo links, and `targetdir` is the name of the directory to which all repos will be cloned. `targetdir` should NOT exist before running the script.