github-backup 0.45.2__tar.gz → 0.46.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,270 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 0.45.2 (2024-05-04)
4
+ 0.46.0 (2024-09-11)
5
5
  -------------------
6
6
  ------------------------
7
+
8
+ Fix
9
+ ~~~
10
+ - Do not double encode auth when retrieving release assets. [Jarl
11
+ Totland]
12
+ - Add now missing setuptools. [Jose Diaz-Gonzalez]
13
+
14
+ Other
15
+ ~~~~~
16
+ - Git fetch is required even when using lfs. [Louis Parisot]
17
+ - Upgrade github workflow ubuntu containers to newest LTS. [Albert Wang]
18
+ - Chore(deps): bump certifi from 2024.6.2 to 2024.7.4. [dependabot[bot]]
19
+
20
+ Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4.
21
+ - [Commits](https://github.com/certifi/python-certifi/compare/2024.06.02...2024.07.04)
22
+
23
+ ---
24
+ updated-dependencies:
25
+ - dependency-name: certifi
26
+ dependency-type: direct:production
27
+ ...
28
+ - Chore(deps): bump docker/build-push-action from 5 to 6.
29
+ [dependabot[bot]]
30
+
31
+ Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
32
+ - [Release notes](https://github.com/docker/build-push-action/releases)
33
+ - [Commits](https://github.com/docker/build-push-action/compare/v5...v6)
34
+
35
+ ---
36
+ updated-dependencies:
37
+ - dependency-name: docker/build-push-action
38
+ dependency-type: direct:production
39
+ update-type: version-update:semver-major
40
+ ...
41
+ - Chore(deps): bump the python-packages group across 1 directory with 3
42
+ updates. [dependabot[bot]]
43
+
44
+ Bumps the python-packages group with 3 updates in the / directory: [autopep8](https://github.com/hhatto/autopep8), [importlib-metadata](https://github.com/python/importlib_metadata) and [setuptools](https://github.com/pypa/setuptools).
45
+
46
+
47
+ Updates `autopep8` from 2.3.0 to 2.3.1
48
+ - [Release notes](https://github.com/hhatto/autopep8/releases)
49
+ - [Commits](https://github.com/hhatto/autopep8/compare/v2.3.0...v2.3.1)
50
+
51
+ Updates `importlib-metadata` from 7.2.0 to 7.2.1
52
+ - [Release notes](https://github.com/python/importlib_metadata/releases)
53
+ - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
54
+ - [Commits](https://github.com/python/importlib_metadata/compare/v7.2.0...v7.2.1)
55
+
56
+ Updates `setuptools` from 70.1.0 to 70.1.1
57
+ - [Release notes](https://github.com/pypa/setuptools/releases)
58
+ - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
59
+ - [Commits](https://github.com/pypa/setuptools/compare/v70.1.0...v70.1.1)
60
+
61
+ ---
62
+ updated-dependencies:
63
+ - dependency-name: autopep8
64
+ dependency-type: direct:production
65
+ update-type: version-update:semver-patch
66
+ dependency-group: python-packages
67
+ - dependency-name: importlib-metadata
68
+ dependency-type: direct:production
69
+ update-type: version-update:semver-patch
70
+ dependency-group: python-packages
71
+ - dependency-name: setuptools
72
+ dependency-type: direct:production
73
+ update-type: version-update:semver-patch
74
+ dependency-group: python-packages
75
+ ...
76
+ - Chore(deps): bump the python-packages group across 1 directory with 2
77
+ updates. [dependabot[bot]]
78
+
79
+ Bumps the python-packages group with 2 updates in the / directory: [importlib-metadata](https://github.com/python/importlib_metadata) and [setuptools](https://github.com/pypa/setuptools).
80
+
81
+
82
+ Updates `importlib-metadata` from 7.1.0 to 7.2.0
83
+ - [Release notes](https://github.com/python/importlib_metadata/releases)
84
+ - [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
85
+ - [Commits](https://github.com/python/importlib_metadata/compare/v7.1.0...v7.2.0)
86
+
87
+ Updates `setuptools` from 70.0.0 to 70.1.0
88
+ - [Release notes](https://github.com/pypa/setuptools/releases)
89
+ - [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
90
+ - [Commits](https://github.com/pypa/setuptools/compare/v70.0.0...v70.1.0)
91
+
92
+ ---
93
+ updated-dependencies:
94
+ - dependency-name: importlib-metadata
95
+ dependency-type: direct:production
96
+ update-type: version-update:semver-minor
97
+ dependency-group: python-packages
98
+ - dependency-name: setuptools
99
+ dependency-type: direct:production
100
+ update-type: version-update:semver-minor
101
+ dependency-group: python-packages
102
+ ...
103
+ - Chore(deps): bump the python-packages group with 3 updates.
104
+ [dependabot[bot]]
105
+
106
+ Bumps the python-packages group with 3 updates: [autopep8](https://github.com/hhatto/autopep8), [flake8](https://github.com/pycqa/flake8) and [pycodestyle](https://github.com/PyCQA/pycodestyle).
107
+
108
+
109
+ Updates `autopep8` from 2.2.0 to 2.3.0
110
+ - [Release notes](https://github.com/hhatto/autopep8/releases)
111
+ - [Commits](https://github.com/hhatto/autopep8/compare/v2.2.0...v2.3.0)
112
+
113
+ Updates `flake8` from 7.0.0 to 7.1.0
114
+ - [Commits](https://github.com/pycqa/flake8/compare/7.0.0...7.1.0)
115
+
116
+ Updates `pycodestyle` from 2.11.1 to 2.12.0
117
+ - [Release notes](https://github.com/PyCQA/pycodestyle/releases)
118
+ - [Changelog](https://github.com/PyCQA/pycodestyle/blob/main/CHANGES.txt)
119
+ - [Commits](https://github.com/PyCQA/pycodestyle/compare/2.11.1...2.12.0)
120
+
121
+ ---
122
+ updated-dependencies:
123
+ - dependency-name: autopep8
124
+ dependency-type: direct:production
125
+ update-type: version-update:semver-minor
126
+ dependency-group: python-packages
127
+ - dependency-name: flake8
128
+ dependency-type: direct:production
129
+ update-type: version-update:semver-minor
130
+ dependency-group: python-packages
131
+ - dependency-name: pycodestyle
132
+ dependency-type: direct:production
133
+ update-type: version-update:semver-minor
134
+ dependency-group: python-packages
135
+ ...
136
+ - Chore(deps): bump urllib3 from 2.2.1 to 2.2.2. [dependabot[bot]]
137
+
138
+ Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2.
139
+ - [Release notes](https://github.com/urllib3/urllib3/releases)
140
+ - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
141
+ - [Commits](https://github.com/urllib3/urllib3/compare/2.2.1...2.2.2)
142
+
143
+ ---
144
+ updated-dependencies:
145
+ - dependency-name: urllib3
146
+ dependency-type: direct:production
147
+ ...
148
+ - Chore(deps): bump the python-packages group across 1 directory with 7
149
+ updates. [dependabot[bot]]
150
+
151
+ Bumps the python-packages group with 7 updates in the / directory:
152
+
153
+ | Package | From | To |
154
+ | --- | --- | --- |
155
+ | [autopep8](https://github.com/hhatto/autopep8) | `2.1.1` | `2.2.0` |
156
+ | [certifi](https://github.com/certifi/python-certifi) | `2024.2.2` | `2024.6.2` |
157
+ | [more-itertools](https://github.com/more-itertools/more-itertools) | `10.2.0` | `10.3.0` |
158
+ | [packaging](https://github.com/pypa/packaging) | `24.0` | `24.1` |
159
+ | [pkginfo](https://code.launchpad.net/~tseaver/pkginfo/trunk) | `1.10.0` | `1.11.1` |
160
+ | [requests](https://github.com/psf/requests) | `2.32.2` | `2.32.3` |
161
+ | [zipp](https://github.com/jaraco/zipp) | `3.18.2` | `3.19.2` |
162
+
163
+
164
+
165
+ Updates `autopep8` from 2.1.1 to 2.2.0
166
+ - [Release notes](https://github.com/hhatto/autopep8/releases)
167
+ - [Commits](https://github.com/hhatto/autopep8/compare/v2.1.1...v2.2.0)
168
+
169
+ Updates `certifi` from 2024.2.2 to 2024.6.2
170
+ - [Commits](https://github.com/certifi/python-certifi/compare/2024.02.02...2024.06.02)
171
+
172
+ Updates `more-itertools` from 10.2.0 to 10.3.0
173
+ - [Release notes](https://github.com/more-itertools/more-itertools/releases)
174
+ - [Commits](https://github.com/more-itertools/more-itertools/compare/v10.2.0...v10.3.0)
175
+
176
+ Updates `packaging` from 24.0 to 24.1
177
+ - [Release notes](https://github.com/pypa/packaging/releases)
178
+ - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst)
179
+ - [Commits](https://github.com/pypa/packaging/compare/24.0...24.1)
180
+
181
+ Updates `pkginfo` from 1.10.0 to 1.11.1
182
+
183
+ Updates `requests` from 2.32.2 to 2.32.3
184
+ - [Release notes](https://github.com/psf/requests/releases)
185
+ - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
186
+ - [Commits](https://github.com/psf/requests/compare/v2.32.2...v2.32.3)
187
+
188
+ Updates `zipp` from 3.18.2 to 3.19.2
189
+ - [Release notes](https://github.com/jaraco/zipp/releases)
190
+ - [Changelog](https://github.com/jaraco/zipp/blob/main/NEWS.rst)
191
+ - [Commits](https://github.com/jaraco/zipp/compare/v3.18.2...v3.19.2)
192
+
193
+ ---
194
+ updated-dependencies:
195
+ - dependency-name: autopep8
196
+ dependency-type: direct:production
197
+ update-type: version-update:semver-minor
198
+ dependency-group: python-packages
199
+ - dependency-name: certifi
200
+ dependency-type: direct:production
201
+ update-type: version-update:semver-minor
202
+ dependency-group: python-packages
203
+ - dependency-name: more-itertools
204
+ dependency-type: direct:production
205
+ update-type: version-update:semver-minor
206
+ dependency-group: python-packages
207
+ - dependency-name: packaging
208
+ dependency-type: direct:production
209
+ update-type: version-update:semver-minor
210
+ dependency-group: python-packages
211
+ - dependency-name: pkginfo
212
+ dependency-type: direct:production
213
+ update-type: version-update:semver-minor
214
+ dependency-group: python-packages
215
+ - dependency-name: requests
216
+ dependency-type: direct:production
217
+ update-type: version-update:semver-patch
218
+ dependency-group: python-packages
219
+ - dependency-name: zipp
220
+ dependency-type: direct:production
221
+ update-type: version-update:semver-minor
222
+ dependency-group: python-packages
223
+ ...
224
+ - --- updated-dependencies: - dependency-name: autopep8 dependency-
225
+ type: direct:production update-type: version-update:semver-patch
226
+ dependency-group: python-packages - dependency-name: black
227
+ dependency-type: direct:production update-type: version-
228
+ update:semver-minor dependency-group: python-packages - dependency-
229
+ name: docutils dependency-type: direct:production update-type:
230
+ version-update:semver-minor dependency-group: python-packages -
231
+ dependency-name: keyring dependency-type: direct:production
232
+ update-type: version-update:semver-minor dependency-group: python-
233
+ packages - dependency-name: platformdirs dependency-type:
234
+ direct:production update-type: version-update:semver-patch
235
+ dependency-group: python-packages - dependency-name: pygments
236
+ dependency-type: direct:production update-type: version-
237
+ update:semver-minor dependency-group: python-packages - dependency-
238
+ name: requests dependency-type: direct:production update-type:
239
+ version-update:semver-minor dependency-group: python-packages -
240
+ dependency-name: tqdm dependency-type: direct:production update-
241
+ type: version-update:semver-patch dependency-group: python-packages
242
+ - dependency-name: twine dependency-type: direct:production
243
+ update-type: version-update:semver-minor dependency-group: python-
244
+ packages - dependency-name: zipp dependency-type: direct:production
245
+ update-type: version-update:semver-patch dependency-group: python-
246
+ packages ... [dependabot[bot]]
247
+ - Chore: update python version in release workflow. [Jose Diaz-Gonzalez]
248
+ - Chore: update python version used in linting. [Jose Diaz-Gonzalez]
249
+ - Chore: drop unsupported python versions and add supported ones. [Jose
250
+ Diaz-Gonzalez]
251
+ - --- updated-dependencies: - dependency-name: requests dependency-
252
+ type: direct:production ... [dependabot[bot]]
253
+ - Chore(deps): bump tqdm from 4.66.2 to 4.66.3. [dependabot[bot]]
254
+
255
+ Bumps [tqdm](https://github.com/tqdm/tqdm) from 4.66.2 to 4.66.3.
256
+ - [Release notes](https://github.com/tqdm/tqdm/releases)
257
+ - [Commits](https://github.com/tqdm/tqdm/compare/v4.66.2...v4.66.3)
258
+
259
+ ---
260
+ updated-dependencies:
261
+ - dependency-name: tqdm
262
+ dependency-type: direct:production
263
+ ...
264
+
265
+
266
+ 0.45.2 (2024-05-04)
267
+ -------------------
7
268
  - Chore(deps): bump idna from 3.6 to 3.7. [dependabot[bot]]
8
269
 
9
270
  Bumps [idna](https://github.com/kjd/idna) from 3.6 to 3.7.
@@ -0,0 +1,361 @@
1
+ Metadata-Version: 2.1
2
+ Name: github-backup
3
+ Version: 0.46.0
4
+ Summary: backup a github user or organization
5
+ Home-page: http://github.com/josegonzalez/python-github-backup
6
+ Author: Jose Diaz-Gonzalez
7
+ Author-email: github-backup@josediazgonzalez.com
8
+ License: MIT
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Topic :: System :: Archiving :: Backup
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Description-Content-Type: text/x-rst
18
+ License-File: LICENSE.txt
19
+
20
+ =============
21
+ github-backup
22
+ =============
23
+
24
+ |PyPI| |Python Versions|
25
+
26
+ The package can be used to backup an *entire* `Github <https://github.com/>`_ organization, repository or user account, including starred repos, issues and wikis in the most appropriate format (clones for wikis, json files for issues).
27
+
28
+ Requirements
29
+ ============
30
+
31
+ - GIT 1.9+
32
+ - Python
33
+
34
+ Installation
35
+ ============
36
+
37
+ Using PIP via PyPI::
38
+
39
+ pip install github-backup
40
+
41
+ Using PIP via Github (more likely the latest version)::
42
+
43
+ pip install git+https://github.com/josegonzalez/python-github-backup.git#egg=github-backup
44
+
45
+ *Install note for python newcomers:*
46
+
47
+ Python scripts are unlikely to be included in your ``$PATH`` by default, this means it cannot be run directly in terminal with ``$ github-backup ...``, you can either add python's install path to your environments ``$PATH`` or call the script directly e.g. using ``$ ~/.local/bin/github-backup``.*
48
+
49
+ Basic Help
50
+ ==========
51
+
52
+ Show the CLI help output::
53
+
54
+ github-backup -h
55
+
56
+ CLI Help output::
57
+
58
+ github-backup [-h] [-u USERNAME] [-p PASSWORD] [-t TOKEN_CLASSIC]
59
+ [-f TOKEN_FINE] [--as-app] [-o OUTPUT_DIRECTORY]
60
+ [-l LOG_LEVEL] [-i] [--starred] [--all-starred]
61
+ [--watched] [--followers] [--following] [--all] [--issues]
62
+ [--issue-comments] [--issue-events] [--pulls]
63
+ [--pull-comments] [--pull-commits] [--pull-details]
64
+ [--labels] [--hooks] [--milestones] [--repositories]
65
+ [--bare] [--lfs] [--wikis] [--gists] [--starred-gists]
66
+ [--skip-archived] [--skip-existing] [-L [LANGUAGES ...]]
67
+ [-N NAME_REGEX] [-H GITHUB_HOST] [-O] [-R REPOSITORY]
68
+ [-P] [-F] [--prefer-ssh] [-v]
69
+ [--keychain-name OSX_KEYCHAIN_ITEM_NAME]
70
+ [--keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT]
71
+ [--releases] [--latest-releases NUMBER_OF_LATEST_RELEASES]
72
+ [--skip-prerelease] [--assets]
73
+ [--exclude [REPOSITORY [REPOSITORY ...]]
74
+ [--throttle-limit THROTTLE_LIMIT] [--throttle-pause THROTTLE_PAUSE]
75
+ USER
76
+
77
+ Backup a github account
78
+
79
+ positional arguments:
80
+ USER github username
81
+
82
+ optional arguments:
83
+ -h, --help show this help message and exit
84
+ -u USERNAME, --username USERNAME
85
+ username for basic auth
86
+ -p PASSWORD, --password PASSWORD
87
+ password for basic auth. If a username is given but
88
+ not a password, the password will be prompted for.
89
+ -f TOKEN_FINE, --token-fine TOKEN_FINE
90
+ fine-grained personal access token or path to token
91
+ (file://...)
92
+ -t TOKEN_CLASSIC, --token TOKEN_CLASSIC
93
+ personal access, OAuth, or JSON Web token, or path to
94
+ token (file://...)
95
+ --as-app authenticate as github app instead of as a user.
96
+ -o OUTPUT_DIRECTORY, --output-directory OUTPUT_DIRECTORY
97
+ directory at which to backup the repositories
98
+ -l LOG_LEVEL, --log-level LOG_LEVEL
99
+ log level to use (default: info, possible levels:
100
+ debug, info, warning, error, critical)
101
+ -i, --incremental incremental backup
102
+ --starred include JSON output of starred repositories in backup
103
+ --all-starred include starred repositories in backup [*]
104
+ --watched include JSON output of watched repositories in backup
105
+ --followers include JSON output of followers in backup
106
+ --following include JSON output of following users in backup
107
+ --all include everything in backup (not including [*])
108
+ --issues include issues in backup
109
+ --issue-comments include issue comments in backup
110
+ --issue-events include issue events in backup
111
+ --pulls include pull requests in backup
112
+ --pull-comments include pull request review comments in backup
113
+ --pull-commits include pull request commits in backup
114
+ --pull-details include more pull request details in backup [*]
115
+ --labels include labels in backup
116
+ --hooks include hooks in backup (works only when
117
+ authenticated)
118
+ --milestones include milestones in backup
119
+ --repositories include repository clone in backup
120
+ --bare clone bare repositories
121
+ --lfs clone LFS repositories (requires Git LFS to be
122
+ installed, https://git-lfs.github.com) [*]
123
+ --wikis include wiki clone in backup
124
+ --gists include gists in backup [*]
125
+ --starred-gists include starred gists in backup [*]
126
+ --skip-existing skip project if a backup directory exists
127
+ -L [LANGUAGES [LANGUAGES ...]], --languages [LANGUAGES [LANGUAGES ...]]
128
+ only allow these languages
129
+ -N NAME_REGEX, --name-regex NAME_REGEX
130
+ python regex to match names against
131
+ -H GITHUB_HOST, --github-host GITHUB_HOST
132
+ GitHub Enterprise hostname
133
+ -O, --organization whether or not this is an organization user
134
+ -R REPOSITORY, --repository REPOSITORY
135
+ name of repository to limit backup to
136
+ -P, --private include private repositories [*]
137
+ -F, --fork include forked repositories [*]
138
+ --prefer-ssh Clone repositories using SSH instead of HTTPS
139
+ -v, --version show program's version number and exit
140
+ --keychain-name OSX_KEYCHAIN_ITEM_NAME
141
+ OSX ONLY: name field of password item in OSX keychain
142
+ that holds the personal access or OAuth token
143
+ --keychain-account OSX_KEYCHAIN_ITEM_ACCOUNT
144
+ OSX ONLY: account field of password item in OSX
145
+ keychain that holds the personal access or OAuth token
146
+ --releases include release information, not including assets or
147
+ binaries
148
+ --latest-releases NUMBER_OF_LATEST_RELEASES
149
+ include certain number of the latest releases;
150
+ only applies if including releases
151
+ --skip-prerelease skip prerelease and draft versions; only applies if including releases
152
+ --assets include assets alongside release information; only
153
+ applies if including releases
154
+ --exclude [REPOSITORY [REPOSITORY ...]]
155
+ names of repositories to exclude from backup.
156
+ --throttle-limit THROTTLE_LIMIT
157
+ start throttling of GitHub API requests after this
158
+ amount of API requests remain
159
+ --throttle-pause THROTTLE_PAUSE
160
+ wait this amount of seconds when API request
161
+ throttling is active (default: 30.0, requires
162
+ --throttle-limit to be set)
163
+
164
+
165
+ Usage Details
166
+ =============
167
+
168
+ Authentication
169
+ --------------
170
+
171
+ **Password-based authentication** will fail if you have two-factor authentication enabled, and will `be deprecated <https://github.blog/2023-03-09-raising-the-bar-for-software-security-github-2fa-begins-march-13/>`_ by 2023 EOY.
172
+
173
+ ``--username`` is used for basic password authentication and separate from the positional argument ``USER``, which specifies the user account you wish to back up.
174
+
175
+ **Classic tokens** are `slightly less secure <https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#personal-access-tokens-classic>`_ as they provide very coarse-grained permissions.
176
+
177
+ If you need authentication for long-running backups (e.g. for a cron job) it is recommended to use **fine-grained personal access token** ``-f TOKEN_FINE``.
178
+
179
+
180
+ Fine Tokens
181
+ ~~~~~~~~~~~
182
+
183
+ You can "generate new token", choosing the repository scope by selecting specific repos or all repos. On Github this is under *Settings -> Developer Settings -> Personal access tokens -> Fine-grained Tokens*
184
+
185
+ Customise the permissions for your use case, but for a personal account full backup you'll need to enable the following permissions:
186
+
187
+ **User permissions**: Read access to followers, starring, and watching.
188
+
189
+ **Repository permissions**: Read access to code, commit statuses, issues, metadata, pages, pull requests, and repository hooks.
190
+
191
+
192
+ Prefer SSH
193
+ ~~~~~~~~~~
194
+
195
+ If cloning repos is enabled with ``--repositories``, ``--all-starred``, ``--wikis``, ``--gists``, ``--starred-gists`` using the ``--prefer-ssh`` argument will use ssh for cloning the git repos, but all other connections will still use their own protocol, e.g. API requests for issues uses HTTPS.
196
+
197
+ To clone with SSH, you'll need SSH authentication setup `as usual with Github <https://docs.github.com/en/authentication/connecting-to-github-with-ssh>`_, e.g. via SSH public and private keys.
198
+
199
+
200
+ Using the Keychain on Mac OSX
201
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
202
+ Note: On Mac OSX the token can be stored securely in the user's keychain. To do this:
203
+
204
+ 1. Open Keychain from "Applications -> Utilities -> Keychain Access"
205
+ 2. Add a new password item using "File -> New Password Item"
206
+ 3. Enter a name in the "Keychain Item Name" box. You must provide this name to github-backup using the --keychain-name argument.
207
+ 4. Enter an account name in the "Account Name" box, enter your Github username as set above. You must provide this name to github-backup using the --keychain-account argument.
208
+ 5. Enter your Github personal access token in the "Password" box
209
+
210
+ Note: When you run github-backup, you will be asked whether you want to allow "security" to use your confidential information stored in your keychain. You have two options:
211
+
212
+ 1. **Allow:** In this case you will need to click "Allow" each time you run `github-backup`
213
+ 2. **Always Allow:** In this case, you will not be asked for permission when you run `github-backup` in future. This is less secure, but is required if you want to schedule `github-backup` to run automatically
214
+
215
+
216
+ Github Rate-limit and Throttling
217
+ --------------------------------
218
+
219
+ "github-backup" will automatically throttle itself based on feedback from the Github API.
220
+
221
+ Their API is usually rate-limited to 5000 calls per hour. The API will ask github-backup to pause until a specific time when the limit is reset again (at the start of the next hour). This continues until the backup is complete.
222
+
223
+ During a large backup, such as ``--all-starred``, and on a fast connection this can result in (~20 min) pauses with bursts of API calls periodically maxing out the API limit. If this is not suitable `it has been observed <https://github.com/josegonzalez/python-github-backup/issues/76#issuecomment-636158717>`_ under real-world conditions that overriding the throttle with ``--throttle-limit 5000 --throttle-pause 0.6`` provides a smooth rate across the hour, although a ``--throttle-pause 0.72`` (3600 seconds [1 hour] / 5000 limit) is theoretically safer to prevent large rate-limit pauses.
224
+
225
+
226
+ About Git LFS
227
+ -------------
228
+
229
+ When you use the ``--lfs`` option, you will need to make sure you have Git LFS installed.
230
+
231
+ Instructions on how to do this can be found on https://git-lfs.github.com.
232
+
233
+
234
+ Run in Docker container
235
+ -----------------------
236
+
237
+ To run the tool in a Docker container use the following command:
238
+
239
+ sudo docker run --rm -v /path/to/backup:/data --name github-backup ghcr.io/josegonzalez/python-github-backup -o /data $OPTIONS $USER
240
+
241
+ Gotchas / Known-issues
242
+ ======================
243
+
244
+ All is not everything
245
+ ---------------------
246
+
247
+ The ``--all`` argument does not include; cloning private repos (``-P, --private``), cloning forks (``-F, --fork``) cloning starred repositories (``--all-starred``), ``--pull-details``, cloning LFS repositories (``--lfs``), cloning gists (``--starred-gists``) or cloning starred gist repos (``--starred-gists``). See examples for more.
248
+
249
+ Cloning all starred size
250
+ ------------------------
251
+
252
+ Using the ``--all-starred`` argument to clone all starred repositories may use a large amount of storage space, especially if ``--all`` or more arguments are used. e.g. commonly starred repos can have tens of thousands of issues, many large assets and the repo itself etc. Consider just storing links to starred repos in JSON format with ``--starred``.
253
+
254
+ Incremental Backup
255
+ ------------------
256
+
257
+ Using (``-i, --incremental``) will only request new data from the API **since the last run (successful or not)**. e.g. only request issues from the API since the last run.
258
+
259
+ This means any blocking errors on previous runs can cause a large amount of missing data in backups.
260
+
261
+ Known blocking errors
262
+ ---------------------
263
+
264
+ Some errors will block the backup run by exiting the script. e.g. receiving a 403 Forbidden error from the Github API.
265
+
266
+ If the incremental argument is used, this will result in the next backup only requesting API data since the last blocked/failed run. Potentially causing unexpected large amounts of missing data.
267
+
268
+ It's therefore recommended to only use the incremental argument if the output/result is being actively monitored, or complimented with periodic full non-incremental runs, to avoid unexpected missing data in a regular backup runs.
269
+
270
+ 1. **Starred public repo hooks blocking**
271
+
272
+ Since the ``--all`` argument includes ``--hooks``, if you use ``--all`` and ``--all-starred`` together to clone a users starred public repositories, the backup will likely error and block the backup continuing.
273
+
274
+ This is due to needing the correct permission for ``--hooks`` on public repos.
275
+
276
+ 2. **Releases blocking**
277
+
278
+ A known ``--releases`` (required for ``--assets``) error will sometimes block the backup.
279
+
280
+ If you're backing up a lot of repositories with releases e.g. an organisation or ``--all-starred``. You may need to remove ``--releases`` (and therefore ``--assets``) to complete a backup. Documented in `issue 209 <https://github.com/josegonzalez/python-github-backup/issues/209>`_.
281
+
282
+
283
+ "bare" is actually "mirror"
284
+ ---------------------------
285
+
286
+ Using the bare clone argument (``--bare``) will actually call git's ``clone --mirror`` command. There's a subtle difference between `bare <https://www.git-scm.com/docs/git-clone#Documentation/git-clone.txt---bare>`_ and `mirror <https://www.git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror>`_ clone.
287
+
288
+ *From git docs "Compared to --bare, --mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository."*
289
+
290
+
291
+ Starred gists vs starred repo behaviour
292
+ ---------------------------------------
293
+
294
+ The starred normal repo cloning (``--all-starred``) argument stores starred repos separately to the users own repositories. However, using ``--starred-gists`` will store starred gists within the same directory as the users own gists ``--gists``. Also, all gist repo directory names are IDs not the gist's name.
295
+
296
+
297
+ Skip existing on incomplete backups
298
+ -----------------------------------
299
+
300
+ The ``--skip-existing`` argument will skip a backup if the directory already exists, even if the backup in that directory failed (perhaps due to a blocking error). This may result in unexpected missing data in a regular backup.
301
+
302
+
303
+ Github Backup Examples
304
+ ======================
305
+
306
+ Backup all repositories, including private ones using a classic token::
307
+
308
+ export ACCESS_TOKEN=SOME-GITHUB-TOKEN
309
+ github-backup WhiteHouse --token $ACCESS_TOKEN --organization --output-directory /tmp/white-house --repositories --private
310
+
311
+ Use a fine-grained access token to backup a single organization repository with everything else (wiki, pull requests, comments, issues etc)::
312
+
313
+ export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
314
+ ORGANIZATION=docker
315
+ REPO=cli
316
+ # e.g. git@github.com:docker/cli.git
317
+ github-backup $ORGANIZATION -P -f $FINE_ACCESS_TOKEN -o . --all -O -R $REPO
318
+
319
+ Quietly and incrementally backup useful Github user data (public and private repos with SSH) including; all issues, pulls, all public starred repos and gists (omitting "hooks", "releases" and therefore "assets" to prevent blocking). *Great for a cron job.* ::
320
+
321
+ export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
322
+ GH_USER=YOUR-GITHUB-USER
323
+
324
+ github-backup -f $FINE_ACCESS_TOKEN --prefer-ssh -o ~/github-backup/ -l error -P -i --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --pull-details --gists --starred-gists $GH_USER
325
+
326
+ Debug an error/block or incomplete backup into a temporary directory. Omit "incremental" to fill a previous incomplete backup. ::
327
+
328
+ export FINE_ACCESS_TOKEN=SOME-GITHUB-TOKEN
329
+ GH_USER=YOUR-GITHUB-USER
330
+
331
+ github-backup -f $FINE_ACCESS_TOKEN -o /tmp/github-backup/ -l debug -P --all-starred --starred --watched --followers --following --issues --issue-comments --issue-events --pulls --pull-comments --pull-commits --labels --milestones --repositories --wikis --releases --assets --pull-details --gists --starred-gists $GH_USER
332
+
333
+
334
+
335
+ Development
336
+ ===========
337
+
338
+ This project is considered feature complete for the primary maintainer @josegonzalez. If you would like a bugfix or enhancement, pull requests are welcome. Feel free to contact the maintainer for consulting estimates if you'd like to sponsor the work instead.
339
+
340
+ Contibuters
341
+ -----------
342
+
343
+ A huge thanks to all the contibuters!
344
+
345
+ .. image:: https://contrib.rocks/image?repo=josegonzalez/python-github-backup
346
+ :target: https://github.com/josegonzalez/python-github-backup/graphs/contributors
347
+ :alt: contributors
348
+
349
+ Testing
350
+ -------
351
+
352
+ This project currently contains no unit tests. To run linting::
353
+
354
+ pip install flake8
355
+ flake8 --ignore=E501
356
+
357
+
358
+ .. |PyPI| image:: https://img.shields.io/pypi/v/github-backup.svg
359
+ :target: https://pypi.python.org/pypi/github-backup/
360
+ .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/github-backup.svg
361
+ :target: https://github.com/josegonzalez/python-github-backup
@@ -0,0 +1 @@
1
+ __version__ = "0.46.0"
@@ -1259,7 +1259,7 @@ def backup_releases(args, repo_cwd, repository, repos_template, include_assets=F
1259
1259
  download_file(
1260
1260
  asset["url"],
1261
1261
  os.path.join(release_assets_cwd, asset["name"]),
1262
- get_auth(args),
1262
+ get_auth(args, encode=not args.as_app),
1263
1263
  as_app=args.as_app,
1264
1264
  fine=True if args.token_fine is not None else False
1265
1265
  )
@@ -1318,13 +1318,15 @@ def fetch_repository(
1318
1318
  git_command = ["git", "remote", "set-url", "origin", remote_url]
1319
1319
  logging_subprocess(git_command, cwd=local_dir)
1320
1320
 
1321
- if lfs_clone:
1322
- git_command = ["git", "lfs", "fetch", "--all", "--prune"]
1323
- else:
1324
- git_command = ["git", "fetch", "--all", "--force", "--tags", "--prune"]
1321
+ git_command = ["git", "fetch", "--all", "--force", "--tags", "--prune"]
1325
1322
  if no_prune:
1326
1323
  git_command.pop()
1327
1324
  logging_subprocess(git_command, cwd=local_dir)
1325
+ if lfs_clone:
1326
+ git_command = ["git", "lfs", "fetch", "--all", "--prune"]
1327
+ if no_prune:
1328
+ git_command.pop()
1329
+ logging_subprocess(git_command, cwd=local_dir)
1328
1330
  else:
1329
1331
  logger.info(
1330
1332
  "Cloning {0} repository from {1} to {2}".format(