873 B
873 B
gitsnips
Backup GitLab snippets to combined repo using git subtrees
Required
- GitLab personal API token with
read_apiprivilege - Automated git project for storing snippets
- curl, git, jq, find, mktemp
Usage
-
Create GitLab API token with
read_apiaccess (private snippets) -
Create a new private gitlab project, then clone and configure
git clone git@gitlab.com:username/snippets.git cd snippets git config user.name "username" git config user.email "username@email.com" -
If using multiple GitLab accounts/SSH keys:
git config core.sshCommand "ssh -i ~/.ssh/username -F /dev/null" -
Specify the token and project directory with
-t ... -d ..../gitsnips.sh -t ABCDEF1234 -d ../snippets/ -p -
Review the above changes and
git pushthe results when ready
SPDX-License-Identifier: MIT