Configuring GitHub Account
For cloning and interacting with repositories, especially private ones, you'll need to configure your GitHub account settings and possibly generate SSH keys.- SSH Keys: If you plan to use SSH for cloning and managing repositories (which is more secure), you'll need to generate an SSH key pair on your remote server and add the public key to your GitHub account.
- Generate a new SSH key pair:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- Add the SSH key to your GitHub account:
- Display the public key using
cat ~/.ssh/id_rsa.pub
, then copy it. - Go to GitHub, navigate to Settings → SSH and GPG keys → New SSH key, paste your key into the field, and save it.
- Display the public key using
- Generate a new SSH key pair:
- Git Configuration: Set your global username and email configuration on the server, which will be used for commits.
git config --global user.name "Your Name" git config --global user.email "your_email@example.com"
~/.ssh
directory and its contents have strict permissions. GitHub requires your private keys to be accessible by you only:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
SSH-Agent: If you're using an SSH key with a passphrase, ensure your SSH agent is running and has your key loaded:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- Enter the following:
You may see a warning like this:$ ssh -T git@github.com # Attempts to ssh to GitHub
> The authenticity of host 'github.com (IP ADDRESS)' can't be established. > ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU. > Are you sure you want to continue connecting (yes/no)?
- Verify that the fingerprint in the message you see matches GitHub's public key fingerprint. If it does, then type
yes
:> Hi USERNAME! You've successfully authenticated, but GitHub does not > provide shell access.