Notes
How to clone form a closed git repo
Install prerequisites.
sudo apt update && sudo apt install git openssh-client
Generate a key, no passphrase for automation.
ssh-keygen -t ed25519 -C "$USER@$(hostname)" -f ~/.ssh/deploy_key
cat ~/.ssh/deploy_key.pub
Add the public key to the deploy keys in the repo settings.
Clone the repo.
GIT_SSH_COMMAND="ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes" git clone git@github.com:user/repo.git
Configure git to automatically add the key to all your future git commands.
git config core.sshCommand "ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes"