# Install and setup

These commands install and initialize etckeeper :

<details id="bkmrk-as-sudo-user-sudo-ap"><summary>as sudo-user</summary>

```bash
sudo apt-get -y install etckeeper
sudo etckeeper init
cd /etc
sudo git checkout -b <branch name>
sudo etckeeper init
sudo git add .
sudo etckeeper commit -m "Initial commit"
sudo git gc # pack git repo to save a lot of space
```

</details><details id="bkmrk-as-root-apt-get--y-i"><summary>as root</summary>

```bash
apt-get -y install etckeeper
etckeeper init
cd /etc
git checkout -b <branch name>
etckeeper init
git add .
etckeeper commit -m "Initial commit"
git gc # pack git repo to save a lot of space
```

</details>You now have to create an ssh-key and add it to your github account :

<details id="bkmrk-as-sudo-user-sudo-ss"><summary>as sudo-user</summary>

```bash
sudo ssh-keygen -t ed25519
sudo cat /root/.ssh/id_ed25519.pub
```

</details><details id="bkmrk-as-root-ssh-keygen--"><summary>as root</summary>

```bash
ssh-keygen -t ed25519
cat /root/.ssh/id_ed25519.pub
```

</details>Copy the resulting ssh-key to your github account.

[https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)

After that, set etckeeper's remote origin :

<details id="bkmrk-as-sudo-user-sudo-gi"><summary>as sudo-user</summary>

```bash
sudo git remote add origin git@github.com:Napoleon280/etckeeper.git
sudo git push --set-upstream origin <branch name>
```

</details><details id="bkmrk-as-root-git-remote-a"><summary>as root</summary>

```bash
git remote add origin git@github.com:Napoleon280/etckeeper.git
git push --set-upstream origin <branch name>
```

</details>Finally, change /etc/etckeeper/etckeeper.conf to push to origin on each commit

```bash
PUSH_REMOTE="origin"
```

```bash
sudo etckeeper commit "etckeeper pushes on commits"
```

ou

```bash
etckeeper commit "etckeeper pushes on commits"
```