1

以下是我的 ~/.ssh/config 内容

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

但是当我尝试对 phpfog repo 文件夹执行 git push 时,它给了我

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

但除非我将 id_rsa_phpfog 重命名为 id_rsa,否则我无法推送到 phpfog。那么我可以指定密钥文件吗

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

4

3 回答 3

1

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
于 2012-05-25T01:31:49.250 回答
0

在我的~/.ssh/config文件中,每个“主机”定义中都有一行:

IdentitiesOnly yes

并且 git 可以为不同的主机使用不同的密钥愉快地工作。

于 2012-05-24T18:06:02.960 回答
0

您可以使用:

ssh phpfog -vvv

获取 ssh 在尝试连接时正在执行的操作的调试输出。如果您使用的是不同的密钥,您应该会看到类似

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

如果您没有看到任何提及id_rsa_phpfog您没有使用您在.ssh/config文件中定义的主机名或文件不在正确位置的信息。

如果一切看起来都正确,则很可能您在 phpfog 上添加的公钥不正确(与您自己的公钥不完全匹配)

于 2012-05-24T20:42:00.927 回答