πππ
Β‘ instructions are intentionally provided for empty repository, otherwise it cannot be guaranteed that files you are going to encrypt haven't been leaked to the repo in previous commits !
mkdir my-encrypted-repo
cd my-encrypted-repo
git init && git-crypt init
curl --user YOUR_GITHUB_NAME https://api.github.com/user/repos --data '{"name":"my-encrypted-repo"}' && \
git remote add origin https://github.com/YOUR_GITHUB_NAME/my-encrypted-repo.gitgit-crypt export-key -- - | gpg --symmetric --armor --output local.key.ascecho "secretfile filter=git-crypt diff=git-crypt" >> .gitattributes
echo "secretfile2 filter=git-crypt diff=git-crypt" >> .gitattributesgit add local.key.asc .gitattributes .gitignore
git commit --message="Config: git-crypt settings"
git push --set-upstream origin masterFollow your usual git workflow, git-crypt will take care of transparent encryption of selected files.
When you need the new file to be encrypted, add it to .gitattributes as stated in Add files which need to be encrypted to .gitattributes.
πππ
‘‘‘ Do it before adding withgit addotherwise non-encrypted file will be committed & pushed to the Internet !!!
git clone https://github.com/you/your-repo.git
cd your-repogpg --decrypt local.key.asc | git-crypt unlock -