0

I have two Github accounts, one is troy and another is yort, I've generated ssh keys for both and associated them to related Github account. BTW, id_rsa is the identity file for troy, and id_rsa_yort is for yort.

For one project of the yort account, I've already set the user.name and user.email of git local config to yort account, but it always turned an error that Permission to yort/xxx.git denied to troy when executing git push.

I've tried many ways, only if I push it via https.git could work. Anyone can help?

Below is the git local config list:

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=git@github.com:yort-xxx/xxx.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.feature/troy/backend.remote=origin
branch.feature/troy/backend.merge=refs/heads/feature/troy/backend
branch.feature/troy/backend_reflection.remote=origin
branch.feature/troy/backend_reflection.merge=refs/heads/feature/troy/backend_reflection
user.name=yort
user.email=yort.xxx@gmail.com
credential.helper=
troy
  • 2,145
  • 2
  • 23
  • 31
  • How have you configured git and ssh to pass different keys for different accounts? – phd Apr 17 '19 at 14:34
  • @phd Just generated different keys then added them to different accounts. – troy Apr 18 '19 at 01:54
  • That's not enough. Without special configuration `git` will just use `ssh` which will use key `id_rsa` for all accounts. – phd Apr 18 '19 at 01:58
  • @phd Yes, it duplicates, and my issue is solved, thank you so much! – troy Apr 18 '19 at 04:01

0 Answers0