Back to roadmaps git Course

Configuring Remotes: GitHub Connection and SSH Keys

To share your project, you need to link your local repository to a remote server like GitHub or GitLab.


1. Generating SSH Keys for Authentication

SSH keys provide a secure connection to GitHub without requiring you to enter your username and password for every action.

Generate a new SSH key in your terminal:

# Generate key using Ed25519 algorithm
ssh-keygen -t ed25519 -C "your.email@example.com"

Press Enter to accept default file locations. Copy the public key output:

# Print public key to terminal for copying
cat ~/.ssh/id_ed25519.pub

Add this copied key to your GitHub account settings under SSH and GPG keys.


2. Linking Local Repositories to Remotes

Once your SSH connection is configured, register the remote repository address in your local git repository:

# Add a remote link named 'origin'
git remote add origin git@github.com:username/repository.git

# Verify registered remote links list
git remote -v

3. Modifying Remotes

If your repository URL changes, update your remote configuration:

# Update remote repository address URL
git remote set-url origin git@github.com:username/new-repository.git
Published on Last updated: