Skip to content

Latest commit

 

History

History
70 lines (56 loc) · 1.28 KB

git_config.md

File metadata and controls

70 lines (56 loc) · 1.28 KB

Git Configuration

Configure Git

  1. Configure Git globally:
git config --global -e
  1. 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
  1. 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
  1. Use SSH instead of HTTP to avoid repeated use of GitHub tokens.

Generate SSH Key Pairs

  1. Generate SSH key pairs:
ssh-keygen -t ed25519 -b 4096 -C "[email protected]"
  1. Copy the public key to your GitHub account.

  2. Edit your ~/.ssh/config file:

nano ~/.ssh/config
  1. Add the following content to the file:
Host *
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_ed25519
  1. Start the SSH agent:
eval "$(ssh-agent -s)"
  1. Add the SSH key to the agent:
ssh-add ~/.ssh/id_ed25519
  1. Verify your GitHub connection:
  1. Finally, Clone your repository using SSH:
git clone [email protected]:github_username/repo