- Configure Git globally:
git config --global -e
- If you haven't set your default editor, configure it:
sudo update-alternatives --install /usr/bin/editor editor /usr/local/bin/nvim 100
sudo update-alternatives --config editor
- Insert the following configuration into your global
.gitconfig
file:
[user]
name = Example Name
email = [email protected]
[core]
editor = nvim --wait
autocrlf = input
[init]
defaultBranch = master
- Use SSH instead of HTTP to avoid repeated use of GitHub tokens.
- Generate SSH key pairs:
ssh-keygen -t ed25519 -b 4096 -C "[email protected]"
-
Copy the public key to your GitHub account.
-
Edit your
~/.ssh/config
file:
nano ~/.ssh/config
- Add the following content to the file:
Host *
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
- Start the SSH agent:
eval "$(ssh-agent -s)"
- Add the SSH key to the agent:
ssh-add ~/.ssh/id_ed25519
- Verify your GitHub connection:
ssh -vT [email protected]
- Finally, Clone your repository using SSH:
git clone [email protected]:github_username/repo