Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7081137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:52:57+00:00 2026-05-28T06:52:57+00:00

GitHub Users, I am newbie on github and have some issue with git setup.

  • 0

GitHub Users,

I am newbie on github and have some issue with git setup.
I have 2 account with different users on github and i have setup git on my system 2 times

First /.ssh folder (as usual) (contain id_rsa which copied in first
account)
Second /.ssh/new folder (contain id_rsa which copied in
second account)

now at the time of push how can i switch between ssh key?

Because if i would like to push for second account it will use .ssh key instead of .ssh/new and gives me error.

Please make me correct if i am understood something wrong here.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:52:57+00:00Added an answer on May 28, 2026 at 6:52 am

    (I’ve voted to close this as a possible duplicate, but I might as well add a similar answer anyway.)

    When using the SSH transport, GitHub identifies you as a user based on the SSH key that you use to authenticate. So, you need to make sure that git is using one SSH key for one repository and another for the other.

    I’m going to assume that:

    1. You have a GitHub account called user1, and you’ve added to that account the public key corresponding to your local private key /home/whoever/.ssh/id_rsa. Let’s say that the repository you’re interested in accessing as user1 is user1/whatever on GitHub.
    2. You have a second GitHub account called user2 and you’ve added to that account the public key corresponding to your local private key /home/whoever/.ssh/new/id_rsa. Let’s say that the repository you’re interested in accessing as user2 is user2/whatever on GitHub.

    The simplest way to do deal with this is to create a new “remote” (i.e. a nickname for a remote repository) for each repository, where the hostname is in each remote’s URL is actually an alias that you’ve set up in ~/.ssh/config. (If that config file doesn’t exist, you’ll have to create it.)

    For example, one entry in the ~/.ssh/config file might look like:

    Host github-as-user1
      HostName github.com
      User git
      IdentityFile /home/whoever/.ssh/id_rsa
    

    Then you can add a remote called gh-user1, say, with:

    git remote add gh-user1 git@github-as-user1:user1/whatever.git
    

    … and then if you want to push your master branch to the repository user1/whatever on GitHub using the ~/.ssh/id_rsa key, you can just do:

    git push gh-user1 master
    

    In order to push as the other user (user2) to the second repository, you need to add a second alias to you ~/.ssh/config file. For example:

    Host gh-as-user2
      HostName github.com
      User git
      IdentityFile /home/whoever/.ssh/new/id_rsa
    

    Then to push to that second repository as the different user, you can just do:

    git push gh-user2 master
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not using github. We have git setup on our machine. I created
I have configured my machine to use one account for a github project for
I have some queries with following scenario on github. consider there is one organization
Suppose we have two separate github users: Foo and Bar. They own Quux and
We have an internal bug tracking system we are trying to integrate with GitHub
I am trying to use django-socialauth ( http://github.com/uswaretech/Django-Socialauth ) for authenticating users for my
Github has the following recommendation for global git configuration ~/.gitconfig : [alias] # Is
I have repository on GitHub to which I commit regularly from my local computer.
I learned of gist.github.com from Mozilla Ubiquity , and have been using it to
I am newbie in GitHub, before i was using SVN for development of visual

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.