Q: git public key for more repositories I'm having following problem.
I have 2 projects and I use github. 1st project went smooth, I created a public key, entered passphrase and pushed into github. no problem.
2nd project, I created another public key and when I want to push to the 2nd repository, it keeps asking for the passphrase for the 1st code /.ssh/id_rsa. but id_rsa holds my public key for 1st project. so of course, when I enter passphrase it wont work because it will try to push into 1st repo instead of 2nd.
how can I create a public key and tell git that I want to push to another repo?
thanks. 

A: You need to declare your different ssh keys in a ~/.ssh/config file, as I explained in "How to manage multiple ssh keys in the ~/.ssh directory"
I would recommend not using the default name for the keys, but rather:
~/.ssh/proj1
~/.ssh/proj1.pub
~/.ssh/proj2
~/.ssh/proj2.pub

And then have a ~/.ssh/config like:
Host ghproj1
    User           git
    Hostname       github.com
    IdentityFile   ~/.ssh/proj1
    IdentitiesOnly yes
Host ghproj2
    User           git
    Hostname       github.com
    IdentityFile   ~/.ssh/proj2
    IdentitiesOnly yes

You need to change the origin url in both repos:
cd /path/to/cloned/proj1
git remote set-url origin ghproj1:yourProject1

cd /path/to/cloned/proj2
git remote set-url origin ghproj1:yourProject2

See more at:


*

*"How to change git ssh user for a remote push temporarily?"

*"Having Trouble Switching Github accounts on terminal"


An url like ghproj1:yourProject1 is an ssh one which will explicitly use the key you specified in ~/.ssh/config for the ghproj1 entry.
In the OP's case (answer below), the correct url would be:
~/.ssh/id_recaprojekt

Note: you need to specify the path to the private key (private, not public, not .pub)
cd /path/to/cloned/plastickychirurg
git remote set-url origin plastickychirurg:michalfeher/plastickychirurg.git

cd /path/to/cloned/recaprojekt
git remote set-url origin recaprojekt:michalfeher/recaprojekt.git

Note that I have added "Hostname" in the Host entries.
The all idea of those entries in the ~/.ssh/config file is to not (repeat not) put git or github.com in the url (it is done for you by the items associated to each entries):
So:
 git@github.com:michalfeher/recaprojekt.git

is the same as:
 recaprojekt:michalfeher/recaprojekt.git

Except the second url will use the ssh key 
