Terragrunt needs to access modules in Github through SSH. You to create a SSH key. If you don't you get errors like this:
error downloading 'ssh://[email protected]/gruntwork-io/terragrunt-infrastructure-modules-example.git?ref=v0.8.0': /usr/local/bin/git exited with 128: Cloning into './.terragrunt-cache/r563FStzoh_StUz-ydYNGw2nq58/9KdFiGzs0Psssz02yWzKhq8EFFM'...
[email protected]: Permission denied (publickey).
In this case, it is using [email protected]
to connect.
Steps to create a new key:
-
Verify you don't already have existing GitHub SSH keys
-
To create a new SSH key replace you email with your GitHub email
ssh-keygen -t ed25519 -C "[email protected]"
-
Start the ssh-agent
eval "$(ssh-agent -s)"
-
Add your SSH private key to the ssh-agent
ssh-add ~/.ssh/id_ed25519
-
Authenticate with GitHub through the CLI
gh auth login
-
Add you SSH public key to your account on GitHub
gh ssh-key add ~/.ssh/id_ed25519.pub --type authentication
-
Verify it works
gh repo list
-
Save your private key