aboutsummaryrefslogtreecommitdiff
path: root/Readme.md
blob: 999d30abe7d2507957a5d35402af1c5b43df5460 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# reposync

Script for juggling git repos

## gitwrapper.sh

Its main purpose is to create a new empty repo if a push to a non-existent one is requested.
It is intended to be used with `command=` option in `.ssh/authorized_keys`.
As a side effect, it also implements a crude access control via SSH keys.
The first argument is the folder this specific key is allowed to push to.

If the command invoked by the ssh client is not `git upload-pack`, it is executed without further checking,
if none is supplied bash starts in interactive mode.
This would allow anyone to easily override the push restrictions,
so they should be seen as a fuck-up-preventer, not a security measure.

## reposync.sh

This script handles synchronisation to GitHub via the GitHub API and SSH,
so it needs a valid API key and an authorized SSH key.
`~/settings.sh` provides `$USERNAME`, `$TOKEN` and `$REPO_DIR`.
If a repo only exists locally, it is created via the API, then pushed.
All repos present on both sides are pushed.
All remote-only repos are cloned.
The last behaviour is only intended for migrating, not for usage.
Repos are only pushed, never fetched so GitHub acts as a mirror and thus should be treated as read-only.

## License

MIT