Backup GitLab snippets to combined repo using git subtrees
This repository has been archived on 2024-03-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
Find a file
2024-03-20 11:04:51 -05:00
gitsnips.sh adding gitsnips.sh 2024-03-20 11:04:51 -05:00
LICENSE Add LICENSE 2024-03-20 11:04:51 -05:00
README.md update README 2024-03-20 11:04:51 -05:00

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