【发布时间】:2015-11-10 13:12:27
【问题描述】:
我有一个要推送到的 Amazon EC2 网络服务器。它的 SSH 连接使用没有密码的密钥进行身份验证。我已经像这样设置了本地机器的 ssh 配置文件
Host web
Hostname <path to host>
User ubuntu
IdentityFile <path to key>
IdentitiesOnly yes
当我这样做时
ssh web
我登录很好,但是当我尝试这样做时
git push web
我明白了
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在本地机器上和
Connection closed by <local machine's IP> [preauth]
在服务器上的 ssh auth.log 文件中。我一直在服务器和本地上一遍又一遍的 SSH 和 git 文件,我就是无法得到它。我可能会错过什么?
.git 配置在本地是
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = https://<bitbucketpath>.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[remote "web"]
url = ubuntu@<server ip>:/home/ubuntu/git/test.git
fetch = +refs/heads/*:refs/remotes/web/*
repo 归 ubuntu 所有,ubuntu 是配置中指定的通过 ssh 登录的用户。
【问题讨论】:
-
您的网址以
https://开头,但您正在研究 ssh 身份验证。我猜你想要ssh://。 -
那是起源,我说的是网络遥控器。除非那很重要?
-
哦,是的,我明白了。我会很明确(ssh://user@addr/home/...),但它应该在那里默认为 ssh,是的(因此不重要)。
标签: git ssh amazon-ec2 ssh-keys git-remote