<rss version="2.0">
  <channel>
    <title>Meet Gor - Tag: github</title>
    <link>https://www.meetgor.com</link>
    <description>Posts tagged with github</description>
    <language>en-us</language>
    <pubDate>Sat, 10 Oct 2026 09:08:39 UTC</pubDate>
    <item>
      <title>Adding SSH Keys for Multiple Accounts in Git</title>
      <link>https://www.meetgor.com/til/git-ssh-multiple-accounts</link>
      <description>Setting up SSH config for using multiple accounts for Git repositories.</description>
      <pubDate>Fri, 22 Mar 2024 00:00:00 UTC</pubDate>
      <content>Let&#39;s  say you have multiple github accounts. One for your personal projects, one for your company that you work at, and one other remote repository account (let&#39;s say gitlab).&#xA;&#xA;You are juggling with multiple accounts, you should not waste much time and pick a SSH from those remote repository and pull it in your local machine, that makes the process just smooth and saves a ton of time.&#xA;&#xA;### Create a SSH Key&#xA;&#xA;To create a SSH key, in linux you can use `ssh-keygen` command.&#xA;&#xA;```bash&#xA;ssh-keygen -t ed25519 -C &#34;alice@example.com&#34;&#xA;```&#xA;&#xA;The above command will prompt you for two things&#xA;&#xA;1. The location where you want to store the key&#xA;2. The passphrase for accessing the key&#xA;&#xA;&#xA;### Add SSH Key to Github&#xA;&#xA;Locate to the `ssh` folder and copy the generated `.pub` file to your `github` account.&#xA;&#xA;For example, if you have created the key at `~/.ssh/your_name` then copy the contents of the file `~/.ssh/your_name.pub` to your clipbaord.&#xA;&#xA;Navigate to your `github` account and in the settings, `SSH and GPG keys` tab, click on `Add SSH key` and copy the contents of your clipboard to the `Key` field.&#xA;&#xA;&#xA;### Configuring the SSH keys for multiple accounts&#xA;&#xA;```config&#xA;Host your_company&#xA;  HostName github.com&#xA;  User git&#xA;  IdentityFile ~/.ssh/your_company&#xA;&#xA;Host your_name&#xA;  HostName github.com&#xA;  User git&#xA;  IdentityFile ~/.ssh/your_name&#xA;&#xA;Host some_name&#xA;  HostName gitlab.com&#xA;  User git&#xA;  IdentityFile ~/.ssh/some_name&#xA;```&#xA;&#xA;You can change the `Host` config tag values in the `~/.ssh/conFig`&#xA;&#xA;The next time you clone/create a repository on those remote git providers, you need to specify the ssh key for that account.&#xA;&#xA;For example, if you have a repository `github.com/StartUp_company/some_wired_project` then you can specify the remote as `git@your_company.com:StartUp_company/some_wired_project`. Here, the `git@your_company` is the `Host` value tag from the `~/.ssh/config`. If that repository is from your `your_company` organisation/user scope, you need to add the `git@your_company` tag, if that&#39;s your project, simply add `git@your_name` before the repository url i.e. `your_name/repo_name` which would set the origin as `git@your_name:your_name/repo_name`, here the 1st `your_name` is the tag from the `Host` config and the 2nd `your_name` is the github username.&#xA;&#xA;So, in summary if you wanted to use multiple accounts in the same machine, you can understand in the following example:&#xA;&#xA;```bash&#xA;ssh -T git@your_name&#xA;&#xA;git clone https://github.com/your_name/repo_name&#xA;```&#xA;&#xA;However, you will need to authenticate with the ssh keys in this way everytime you push/pull a repository. So for that, you can set the origin with the `git@your_name` tag as the host for automatically authenticating the ssh keys on every push/pull or other activities.&#xA;&#xA;Thanks for reading, Happy Coding :)</content>
      <type>til</type>
    </item>
  </channel>
</rss>