我第一次做git pull并且已经在git中提示无法建立主机的真实性,与我生成的私钥相比,RSA密钥指纹不正确。我只是想知道如何更新它,以便它读取正确的文件,为什么它首先读取错误的指纹?
答案 0 :(得分:14)
我有类似的问题,这意味着远程主机未知/不可信。修复方法是在known_hosts文件中包含远程主机条目。
这就是我所做的:
生成(或使用现有的)RSA密钥并将其存储在<USER.HOME>/.ssh
文件中。如果您使用的是eclipse,则可以使用Preferences生成RSA密钥;
Generate RSA Key...
Save Private Key...
现在您的<USER.HOME>/.ssh
将包含文件;私钥,公钥和known_hosts
ssh -vt <user>@<hostname>
现在,如果您尝试将文件推送到远程,则看不到任何错误。
答案 1 :(得分:0)
我遇到的另一个问题是> terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
aws_elasticache_subnet_group.default: Refreshing state... (ID: subnet-group-engineering-st-api-production)
aws_security_group.redis: Refreshing state... (ID: sg-3cc2dd4d)
aws_security_group.redis: Refreshing state... (ID: sg-70d13102)
aws_elasticache_subnet_group.default: Refreshing state... (ID: subnet-group-engineering-st-api-20171007-production)
aws_security_group_rule.access_in_api_cache_20171007: Refreshing state... (ID: sgrule-2218275132)
aws_security_group_rule.access_out_api_cache_20171007: Refreshing state... (ID: sgrule-2359785285)
aws_elasticache_cluster.redis: Refreshing state... (ID: st-api-2017-10-07)
aws_elasticache_cluster.redis: Refreshing state... (ID: st-api-2017-08-17)
aws_security_group_rule.access_in: Refreshing state... (ID: sgrule-3430292237)
aws_security_group_rule.access_out: Refreshing state... (ID: sgrule-1891306978)
Error: Error refreshing state: 1 error(s) occurred:
* module.api_cache_20171007.output.endpoint: At column 3, line 1: join: argument 1 should be type list, got type string in:
${join(":", aws_elasticache_cluster.redis.cache_nodes.0.address, aws_elasticache_cluster.redis.cache_nodes.0.port)}
文件中的多个条目以及known_hosts
文件。
我唯一的猜测是,因为我在known_hosts2
中重用了一个主机名来指向不同的IP,所以它混淆了创建的多个条目。
答案 2 :(得分:0)
这里有一个更好的答案:
http://stackoverflow.com/questions/2643502/git-permission-denied-publickey
这救了我!!
这些命令仅在git bash提示符下起作用。对于Windows,您很可能需要将其放在c:/ users //。ssh目录中。并将您的密钥命名为“ is_rsa”。密码是可选的,如果您提供密码,则每次拉动时都会提示您输入密码。
祝你好运。
答案 3 :(得分:0)
答案 4 :(得分:0)
将 ssh 密钥添加到 GitLab 后,当您尝试克隆存储库时,如果直接按 enter
,则会出现以下错误:
Cloning into 'hfe-insure-m'...
The authenticity of host 'git.zhonganinfo.com (100.112.23.182)' can't be established.
ECDSA key fingerprint is SHA256:IRLOr2bTvVB2rLgYVgyUibE+oLlZ0pUwU9wycc/5zYU.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
确保在看到以下句子时输入 yes
,不要直接按 enter
。
您确定要继续连接吗(是/否/[指纹])?是的
例如
Cloning into 'hfe-insure-m'...
The authenticity of host 'git.zhonganinfo.com (100.112.23.182)' can't be established.
ECDSA key fingerprint is SHA256:IRLOr2bTvVB2rLgYVgyUibE+oLlZ0pUwU9wycc/5zYU.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'git.zhonganinfo.com,100.112.23.182' (ECDSA) to the list of known hosts.
remote: Enumerating objects: 31607, done.
remote: Counting objects: 100% (31607/31607), done.
remote: Compressing objects: 100% (10365/10365), done.
remote: Total 31607 (delta 20695), reused 31485 (delta 20604)
Receiving objects: 100% (31607/31607), 21.51 MiB | 581.00 KiB/s, done.
Resolving deltas: 100% (20695/20695), done.