README.md (2128B) - raw
1 # Git Backup 2 3 Very simple script to back up all the repositories the user is member of on 4 GitLab and GitHub. 5 6 ## Prerequisites 7 8 In order to run the program, you will need `python3` and the python libraries 9 specified in the `requirements.txt` file. If you have `pip3` installed, you can 10 install the libraries with the command: 11 12 ``` 13 pip3 install -r requirements.txt 14 ``` 15 16 You will also need a GitLab and a GitHub access token and crete a file named 17 `tokens.json` with the following content: 18 19 ```json 20 { 21 "gitlab.com":"<GitLab token>", 22 "github.com":"<GitHub token>" 23 } 24 ``` 25 26 Finally, you must upload your ssh key to GitLab or GitHub if you have any 27 private or internal repositories. 28 29 ## Running the program 30 31 To run the program, execute the file `git-backup.py`: 32 33 ``` 34 python3 git-backup.py 35 ``` 36 37 ### Adding custom repositories 38 39 If you want to backup repositories from which you are not a member on the 40 currently supported hosts, or if you want to add repositories from other hosts, 41 you can do so creating a file named `custom_directories.json` with the following 42 structure: 43 44 ```json 45 [ 46 { 47 "name":"<Repository name - for backup information>", 48 "description":"<Repository description - for backup information>", 49 "path":"<Repository path where the backup will be saved>", 50 "ssh_url":"<Repository url>", 51 "host":"<Repository host - for backup information and establishing saving directory>" 52 } 53 ] 54 ``` 55 56 You can add more than one object to the array and it will backup all of the 57 repositories. Make sure that you upload your ssh key to the hosts in case it is 58 needed for authentification. 59 60 ## Future updates 61 62 - [ ] More information on the output file or the terminal: how many new 63 repositories were added, how many have been deleted on the hosting 64 services. 65 - [ ] Manage what happens if history has changed in the hosting service. 66 67 ## License 68 69 The program is licensed under the GNU Affero General Public License version 3 or 70 later (available [here][agpl]). 71 72 ## Author 73 74 - **Oscar Benedito** - oscar@oscarbenedito.com 75 76 [agpl]: <https://www.gnu.org/licenses/agpl-3.0.html> "GNU Affero General Public License v3.0"