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

  • SEARCH
  • Home
  • 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 8115381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:27:53+00:00 2026-06-06T03:27:53+00:00

This is probably not a dup; I have read through many similar problems on

  • 0

This is probably not a dup; I have read through many similar problems on StackOverflow but not this issue.

I am trying to use multiple git accounts on Ubuntu Linux and whenever I try to push from the 2nd account it thinks that I am still using the username of the first account.

$ git push -u origin master
ERROR: Permission to <act2>/<repo>.git denied to <act1>.

I first tried the multiple SSH key method. When I got the above error I then created a completely new user on my local machine, logged in as that user, recreated the local repo (its the first push) and tried again. Same error. My local .config shows the user as and so does my ~/.gitconfig.

Any ideas?

I do:
ssh @localhost
then ssh -vvv -T git@github.com

I get this interesting output. It seems to go off and find a key in my account. But somehow it uses a key in my account, which is really shouldn’t have access to.


debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home//.ssh/known_hosts:1
debug2: bits set: 513/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: Wrote 16 bytes for a total of 1015
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug3: Wrote 48 bytes for a total of 1063
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key:  
debug2: key:  
debug2: key: /home//.ssh/identity ((nil))
debug2: key: /home//.ssh/id_rsa ()
debug2: key: /home//.ssh/id_dsa ((nil))
debug3: Wrote 64 bytes for a total of 1127
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,gssapi,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: 
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1495
debug1: Authentications that can continue: publickey
debug1: Offering public key: 
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug3: Wrote 368 bytes for a total of 1863
debug1: Remote: Forced command: gerve 
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: fp 
debug3: sign_and_send_pubkey
debug3: Wrote 640 bytes for a total of 2503
debug1: Remote: Forced command: gerve 
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug3: Wrote 128 bytes for a total of 2631
debug2: callback start
...
  • 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-06-06T03:27:55+00:00Added an answer on June 6, 2026 at 3:27 am

    This happens because ssh-agent caches the ssh key (you can even remove the file and it will still allow ssh to connect successfully until the cache is cleared) and will prioritise the cached keys even over the ones specified via IdentityFile. You can see which files are cached by running:

    ssh-add -l
    

    You can force ssh-agent to ignore the cache by including IdentitiesOnly “yes” in the .ssh/config for each connection:

    Host github
      HostName github.com
      User git
      IdentityFile ~/.ssh/id_rsa
      IdentitiesOnly yes
    
    Host github-work
      HostName github.com
      User git
      IdentityFile ~/.ssh/id_dsa_work
      IdentitiesOnly yes
    

    More information here: http://sealedabstract.com/code/github-ssh-with-multiple-identities-the-slightly-more-definitive-guide/

    It took me quite a while to discover this too, hope it helps someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a dup (but did not find it..) When you type ls
I know this is probably not possible but let's say I have a model
i'm very aware that this is probably not a stackoverflow question, but i figure
I have a feeling that this probably is not possible using strictly CSS, but,
This is probably not possible, but I have this class: public class Metadata<DataType> where
This question not probably not typical stackoverflow but am not sure where to ask
This is probably not very elegant, but what I'm trying to do is connect
This is probably not possible with CSS, but maybe I'm wrong: I have a
This is weird and probably not possible but I'll ask anyway. I'm making this
I know this probably really simple but Im not sure what im doing wrong...

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.