aWebDeveloper
aWebDeveloper

Reputation: 38422

How do I specify which key file to use for Git Push on PHP Fog?

Following is my ~/.ssh/config contents

ForwardAgent yes

# Default PHP Fog user (name)
Host phpfog
HostName git01.phpfog.com
User git
IdentityFile /Users/Pk_2/.ssh/id_rsa_phpfog


# Default github
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /Users/Pk_2/.ssh/id_rsa

But when i try to do a git push on a phpfog repo folder it gives me

Permission denied(public key)
fatal:the  remote end hung up unexpectedly 

But Unless i rename id_rsa_phpfog to id_rsa i can't push to phpfog. So can i specify the key file

PHPFog config - http://docs.phpfog.com/getting-started/ssh/

Upvotes: 1

Views: 512

Answers (3)

Tim Santeford
Tim Santeford

Reputation: 28151

Your project's .git/config may need to be edited to allow the origin to use the host you defined in the ~/.ssh/config

Edit your < project folder >/.git/config file

[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = <ssh-config-host>:<app_name_here>

If your apps name is www.example.com then the url line would look like:

url = phpfog:www.example.com

Alternatively you could also re-clone your app using the host you defined:

git clone phpfog:www.example.com

Upvotes: 1

AD7six
AD7six

Reputation: 66349

You can use:

ssh phpfog -vvv

To get debug output of what ssh is doing when it tries to connect. if you're using a different key you should see something like

debug1: Reading configuration data /Users/<yourusername>/.ssh/config
debug1: Applying options for phpfog
debug1: Reading configuration data /etc/ssh_config
...
debug1: Offering RSA public key: /Users/<yourusername>/.ssh/id_rsa_phpfog
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply

If you don't see anything that mentions id_rsa_phpfog you're either not using the hostname you've defined in your .ssh/config file or the file isn't in the right place.

If all that looks correct it's most likely the public key you've added on phpfog isn't correct (doesn't exactly match your own public key)

Upvotes: 0

Raymond Tau
Raymond Tau

Reputation: 3479

In my ~/.ssh/config file, there is an additional line in each "Host" definition:

IdentitiesOnly yes

And git works happily with different key for different host.

Upvotes: 0

Related Questions