Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 814 Bytes

README.md

File metadata and controls

41 lines (30 loc) · 814 Bytes

How to Clone a GitHub Private Repository on a Server | Step-by-Step Guide

1. Generate a New SSH Key

ssh-keygen -t ed25519 -C "your_email@example.com"

2. Add Your SSH Key to the SSH Agent

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

3. Add the SSH Key to Your GitHub Account

copy the SSH public key to your clipboard:

cat ~/.ssh/id_ed25519.pub

Go to GitHub Settings > SSH and GPG keys, click "New SSH key," and paste your key.

4. Test the SSH Connection

ssh -T git@github.com

5. Update Repository Remote URL

Go to the folder of your repo:

git remote set-url origin git@github.com:GITHUB_USERNAME/REPO_NAME.git

6. Pull the Repository

git pull origin main