{
  "slug": "How-to-make-several-ssh-keys-in-Ubuntu-for-manage-different-repositories-in-GitHub-e224a5156752",
  "title": "How to make several ssh keys in Ubuntu for manage different repositories in GitHub",
  "subtitle": "In this tutorial, I will explain how to make a ssh key for different repositories.",
  "excerpt": "In this tutorial, I will explain how to make a ssh key for different repositories.",
  "date": "2023-07-31",
  "tags": [
    "Linux"
  ],
  "readingTime": "1 min",
  "url": "https://medium.com/@mobinshaterian/how-make-multiply-ssh-key-in-ubuntu-e224a5156752",
  "hero": "https://cdn-images-1.medium.com/max/800/1*43KUc_SAu5rc_f7t024ekA.png",
  "content": [
    {
      "type": "heading",
      "level": 2,
      "text": "How to make several ssh keys in Ubuntu for manage different repositories in GitHub"
    },
    {
      "type": "paragraph",
      "html": "In this tutorial, I will explain how to make a ssh key for different repositories."
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*43KUc_SAu5rc_f7t024ekA.png",
      "alt": "https://www.keycdn.com/support/create-ssh-key",
      "caption": "https://www.keycdn.com/support/create-ssh-key",
      "width": 726,
      "height": 366
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Make ssh key in Ubuntu system"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "cd ~/.ssh/"
    },
    {
      "type": "code",
      "lang": "typescript",
      "code": "ssh-keygen -t rsa -b 4096 -C \"you@example.com\"ssh-keygenGenerating public/private rsa key pair.Enter\nfile in which to save the key (/home/name/.ssh/id_rsa): id_rsa_personalEnter passphrase (empty for\nno passphrase): Enter same passphrase again: Your identification has been saved in\nid_rsa_personalYour public key has been saved in id_rsa_personal.pubThe key fingerprint is:"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "cat id_rsa_p2.pub"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Add to Github account"
    },
    {
      "type": "image",
      "src": "https://cdn-images-1.medium.com/max/800/1*z6x-Vrh6Bwn_yS-I-W_91g.png",
      "alt": "How to make several ssh keys in Ubuntu for manage different repositories in GitHub",
      "caption": "",
      "width": 831,
      "height": 138
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Add account in Config"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "cat configHost github.com    User user1    Hostname github.com    IdentityFile ~/.\nssh/id_rsa\nIdentitiesOnly yes                Host github2    User user2    Hostname github.com    IdentityFile\n~/.\nssh/id_rsa_personal    IdentitiesOnly yes"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Git clone repository"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "git clone git@github.com:name/repository.git"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Add email and username in folder"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "git config  user.email \"email@gmail.com\"\ngit config  user.name  \"Name\""
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Add Git remote"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "git remote add selectedName git@github2:name/repository.git"
    },
    {
      "type": "code",
      "lang": "bash",
      "code": "git remote -v"
    },
    {
      "type": "heading",
      "level": 2,
      "text": "Push on server"
    },
    {
      "type": "paragraph",
      "html": "git push selectedName main"
    }
  ]
}
