Stori.
Sử dụng SSH key để xác thực tài khoản Github, Gitlab
5 min read

Sử dụng SSH key để xác thực tài khoản Github, Gitlab

Git

1. Tạo SSH key

  • Windows
  • ssh-keygen -t ed25519 -C "your_email@example.com"
    Get-Service -Name ssh-agent | Set-Service -StartupType Manual
    Start-Service ssh-agent
    ssh-add c:/Users/YOUR_USERNAME/.ssh/id_ed25519
    cat ~/.ssh/id_ed25519.pub | clip
  • macOS / Linux
  • ssh-keygen -t ed25519 -C "your_email@example.com"
    eval "$(ssh-agent -s)"
    cat /Users/YOUR_USERNAME/.ssh/id_ed25519.pub

    2. THÊM SSH KEY VÀO TÀI KHOẢN GIT

  • Github
  • Truy cập Settings / SSH and GPG keys

    Ở tab SSH keys ấn nút New SSH key

    Note image
  • Gitlab
  • Truy cập Preferences / SSH Keys

    Ấn nút Add new key

    Note image

    3. Kiểm tra kết nối

    //Github
    ssh -T git@github.com
    //Gitlab
    ssh -T git@gitlab.com
    //Gitlab with custom domain
    ssh -T git@customdomain.com

    Share this article

    Share:
    Read Next Article