Domanda

(some important background): I am an owner of my work's github repo. for this example I will call it "organization/organization"

So,I created some personal, side-project code and decided, afterwards, to push this to a new repo. I created a new repo at github.com. Then did:

git init
git add -A
git commit -am "first commit"
git remote add origin git@github.com:fakename/testapp.git
git push -u origin master

Everything works until that last command:

git push -u origin master

I then get this error:

ERROR: Permission to fakename/testapp.git denied to organization/organization.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Why does git think I'm an organization?!?! Here's my config:

user.name=Mad Jon
user.email=personalemail@hotmail.com
core.ignorecase=false
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=false
remote.origin.url=git@github.com:fakename/testapp.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

I'm not doing anything to do with my organization. I don't know why it thinks I'm it. But I'd like it to force it to think I'm the normal user. not the org.

È stato utile?

Soluzione

When using ssh url (like git@github.com:fakename/testapp.git), the most likely explanation is that you didn't defined a new ssh key, and used the appropriate ~/.ssh/config file in order to declare to Git what ssh key to use.

Your ssh url would become:

mysecondrepo:fakename/testapp.git

With an ssh config file like:

Host mysecondrepo
  HostName github.com
  User git
  IdentityFile ~/.ssh/id_rsa_mysecondrepo

See "How to work on personal GitHub repo from office computer whose SSH key is already added to a work related GitHub account?" for more on multiple ssh key management.


Of course, switching to https url (as commented by the OP) works:

 https://fakename@github.com/fakename/testapp.git

It forces you to identify with your account.
But it doesn't solve the ssh configuration issue.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top