32 lines
873 B
Markdown
32 lines
873 B
Markdown
# gitsnips
|
|
|
|
Backup GitLab snippets to combined repo using git subtrees
|
|
|
|
## Required
|
|
|
|
- GitLab personal API token with `read_api` privilege
|
|
- Automated git project for storing snippets
|
|
- curl, git, jq, find, mktemp
|
|
|
|
## Usage
|
|
|
|
1. Create GitLab API token with `read_api` access (private snippets)
|
|
2. 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"
|
|
|
|
3. If using multiple GitLab accounts/SSH keys:
|
|
|
|
git config core.sshCommand "ssh -i ~/.ssh/username -F /dev/null"
|
|
|
|
4. Specify the token and project directory with `-t ... -d ...`
|
|
|
|
./gitsnips.sh -t ABCDEF1234 -d ../snippets/ -p
|
|
|
|
5. Review the above changes and `git push` the results when ready
|
|
|
|
SPDX-License-Identifier: MIT
|
|
|