Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Initializing cottage

Scenarios for initializing cottage in a new or existing git repository:

  1. I want to create a fresh new git repo and keep secrets in it
  2. I want to add cottage to an existing git repo
  3. I want to undo ctg init

I want to create a fresh new git repo and keep secrets in it

To start a fresh new repo with secrets, run:

cd /tmp
mkdir myproject
cd myproject
git init

ctg init
Initialized empty Git repository in /tmp/tmp....XXX.../.git/

To confirm that the repository is properly initialized, run:

git status --short
?? .cottage/
?? .gitattributes

Check the contents in the .cottage directory:

tree .cottage
.cottage
└── recipients
    └── ...XXX...

1 directory, 1 file

The private key is stored safely in ~/.config/cottage/identity/myproject/<timestamp>.key.

Check the contents of .gitattributes:

cat .gitattributes
*.cott.age binary linguist-generated filter=cottage-encrypted -diff

I want to add cottage to an existing git repo

To add cottage to an existing git repository (e.g. sayanarijit/jf), run:

git clone git@github.com:sayanarijit/jf.git
cd jf

ctg init

To confirm that the repository is properly initialized, run:

git status --short
?? .cottage/
?? .gitattributes
tree .cottage
.cottage
└── recipients
    └── ...XXX...

The private key is stored safely in ~/.config/cottage/identity/jf/<timestamp>.key.

To confirm that .gitattributes is properly updated, run:

grep .cott.age .gitattributes
*.cott.age binary linguist-generated filter=cottage-encrypted -diff

I want to undo ctg init

For some reason, if you want to undo the ctg init command, you can run:

ctg clean --all

git status --short
# no output