git - 服务器主机密钥未缓存

发布于 2024-10-16 12:46:44 字数 819 浏览 6 评论 0 原文

我尝试将更改从本地存储库推送到远程存储库。当我输入:

git push origin

我收到以下错误:

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Connection abandoned.
fatal: The remote end hung up unexpectedly

我该如何解决这个问题?我在 Windows 7 中从命令行使用 git。

编辑

当我尝试执行简单的 ssh 时,

ssh user@hostname

出现以下错误:

Could not create directory '/c//%HOMEDRIVE%%HOMEPATH%/.ssh'.
percent_expand: unknown key %H

不知怎的,它不会创建目录,因为路径无效。如何解决这个问题?

@eckes:Edit2

我的主页设置为 %HOMEDRIVE%%HOMEPATH% 这是正确的吗?

I try to push changes from my local repo to a remote repo. When I type:

git push origin

I get the following error:

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
Connection abandoned.
fatal: The remote end hung up unexpectedly

How can I solve this? I'm using git from the command line in Windows 7.

Edit

When I try to do a simple ssh

ssh user@hostname

I get the following error:

Could not create directory '/c//%HOMEDRIVE%%HOMEPATH%/.ssh'.
percent_expand: unknown key %H

Somehow it will not create the directory, because the path is invalid. How to fix this?

@eckes: Edit2

My Home is set to %HOMEDRIVE%%HOMEPATH% is this correct?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(21

旧城烟雨 2024-10-23 12:46:44

对于那些通过标准命令提示符使用 PuTTY 在 Windows 上设置 MSYS Git 的人,将主机添加到 PuTTY 缓存的方法是运行

> plink.exe <host>

例如:

> plink.exe codebasehq.com

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 2e:db:b6:22:f7:bd:48:f6:da:72:bf:59:d7:75:d7:4e
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

只需回答 y,然后按 Ctrl+其余的C。

不过,请检查指纹。这个警告是有充分理由的。一些 git 服务的指纹(请编辑以添加更多):

For those of you who are setting up MSYS Git on Windows using PuTTY via the standard command prompt, the way to add a host to PuTTY's cache is to run

> plink.exe <host>

For example:

> plink.exe codebasehq.com

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 2e:db:b6:22:f7:bd:48:f6:da:72:bf:59:d7:75:d7:4e
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

Just answer y, and then Ctrl+C the rest.

Do check the fingerprint though. This warning is there for a good reason. Fingerprints for some git services (please edit to add more):

内心荒芜 2024-10-23 12:46:44

尝试从 Git Bash 提示符中执行“set | grep -i ssh”

如果您的设置与我的类似,您可能已经设置了这些:

GIT_SSH='C:\Program Files (x86)\PuTTY\plink.exe'
PLINK_PROTOCOL=ssh
SVN_SSH='"C:\\Program Files (x86)\\PuTTY\\plink.exe"'

我做了一个

unset GIT_SSH
unset PLINK_PROTOCOL
unset GIT_SVN

,然后它就工作了,..我猜 putty 将其密钥保存在其他地方作为 $HOME /.ssh 或其他...(我在 $HOME 设置为“C:\Users\usrnam”而不是“/C/Users/usrnam/”的盒子上也遇到了问题

,无论如何,您的里程可能会有所不同,但这对我来说解决了:-)

(可能只需要取消设置 GIT_SSH 就足够了,但我很高兴)

注意:如果取消设置对你不起作用,请尝试以下操作:

set GIT_SSH=

Try doing a "set | grep -i ssh" from the Git Bash prompt

If your setup is like mine you probably have these set:

GIT_SSH='C:\Program Files (x86)\PuTTY\plink.exe'
PLINK_PROTOCOL=ssh
SVN_SSH='"C:\\Program Files (x86)\\PuTTY\\plink.exe"'

I did a

unset GIT_SSH
unset PLINK_PROTOCOL
unset GIT_SVN

and it worked after that,.. I guess putty saves its keys somewhere else as $HOME/.ssh or something... (I've also had a problem on a box where $HOME was set to "C:\Users\usrnam" instead of "/C/Users/usrnam/"

anyway, your mileage may vary, but that fixed it for me. :-)

(probably just doing the unset GIT_SSH is enough, but I was on a roll)

Note: if unset doesn't work for you, try this:

set GIT_SSH=
凉城凉梦凉人心 2024-10-23 12:46:44

该消息意味着 origin 的主机密钥不存在于您的可信主机文件中。

要解决此问题,请打开到 origin 的普通 SSH 连接,SSH 会询问您是否要信任远程主机(从 Git 控制台):

$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is <FINGERPRINT>.
Are you sure you want to continue connecting (yes/no)?

如果您信任远程主机(即键入 yes),SSH 会将其密钥添加到已知主机列表中。

之后,您应该能够执行git Push origin

作为替代方案,您还可以手动将 origin 密钥添加到 .ssh/known_hosts 中,但这要求您遵守 known_hosts 的格式> 文件,如 sshd 的手册页中所述( AUTHORIZED_KEYS 文件格式部分)。

The message means that the host key of origin is not present in your trusted hosts file.

To get around this, open a plain SSH connection to origin and SSH will ask you if you want to trust the remote host (from the Git console):

$ ssh 127.0.0.1
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
RSA key fingerprint is <FINGERPRINT>.
Are you sure you want to continue connecting (yes/no)?

If you trust the remote host (i.e. type yes), SSH will add its key to the list of known hosts.

After that, you should be able to do your git push origin.

As an alternative, you could also manually add the key of origin to .ssh/known_hosts but this requires that you adhere to the format of the known_hosts file as described in the man page of sshd (Section AUTHORIZED_KEYS FILE FORMAT).

酒中人 2024-10-23 12:46:44

我怀疑您的 GIT_SSH 环境变量设置为 %ProgramFiles(x86)%\putty\plink.exe
由于某些原因,PLink 不使用用户目录中的 .ssh/known_hosts 文件来存储远程主机密钥。

如果这确实是您的情况,并且您想使用选美可能是故意的,则需要先使用 PLink 连接到主机。

"$GIT_SSH" user@hostname

您应该会收到类似的消息

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 86:7b:1b:12:85:35:8a:b7:98:b6:d2:97:5e:96:58:1d
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

一旦您回答了问题并成功连接到远程主机,您就应该准备就绪。继续并再次尝试推动。

I suspect that your GIT_SSH environment variable is set to %ProgramFiles(x86)%\putty\plink.exe.
For some reason, PLink does not use the .ssh/known_hosts file in your user directory to store the remote hosts keys.

If this is actually your case, and it might be so on purpose if you want to use pageant, you need to use PLink to connect to the host first.

"$GIT_SSH" user@hostname

You should get a similar message

The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 86:7b:1b:12:85:35:8a:b7:98:b6:d2:97:5e:96:58:1d
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

Once you have answered y to the question and successfully connected to the remote host, you should be all set. Go ahead and try your push again.

执着的年纪 2024-10-23 12:46:44

仅通过 ssh 连接到主机是不够的,至少在 Windows 上是这样。这会将主机密钥添加到 ssh/known_hosts 中,但错误仍然存​​在。

您需要关闭 git bash 窗口并打开一个新窗口。然后注册表缓存被清除,推/拉操作即可开始工作。

Just ssh'ing to the host is not enough, on Windows at least. That adds the host key to ssh/known_hosts but the error still persists.

You need to close the git bash window and open a new one. Then the registry cache is cleared and the push/pull then works.

橙味迷妹 2024-10-23 12:46:44

如果您在使用 ATLASSIAN SOURCETREE 执行 git 推/拉操作时收到有关无法识别的主机密钥的消息,您将无法回答 y/n,并且推/拉操作将在不缓存密钥的情况下中止。但是,转到 SourceTree Tools->Options(常规选项卡)并将 SSH 客户端(在 SSH 客户端配置下)从 PuTTY 更改为 OpenSSH 将允许缓存密钥,而无需更改任何其他内容。

If you receive the message about the unrecognized host key while doing git push/pull operations using ATLASSIAN SOURCETREE you do not have the ability to answer y/n and the push/pull operation will be aborted without caching the key. However going to SourceTree Tools->Options (General Tab) and changing the SSH Client under (under SSH Client Configuration) from PuTTY to OpenSSH will allow the key to be cached without changing anything else.

許願樹丅啲祈禱 2024-10-23 12:46:44

Rene,您的 HOME 变量设置不正确。将其更改为 c:\Users\(your-username) 或仅更改为 %USERNAME%

Rene, your HOME variable isn't set correctly. Either change it to c:\Users\(your-username) or just to %USERNAME%.

半边脸i 2024-10-23 12:46:44

使用 Plink 的解决方案

此 python 脚本 保存到 known_hosts.py

#! /usr/bin/env python

# $Id$
# Convert OpenSSH known_hosts and known_hosts2 files to "new format" PuTTY
# host keys.
#   usage:
#     kh2reg.py [ --win ] known_hosts1 2 3 4 ... > hosts.reg
#       Creates a Windows .REG file (double-click to install).
#     kh2reg.py --unix    known_hosts1 2 3 4 ... > sshhostkeys
#       Creates data suitable for storing in ~/.putty/sshhostkeys (Unix).
# Line endings are someone else's problem as is traditional.
# Developed for Python 1.5.2.

import fileinput
import base64
import struct
import string
import re
import sys
import getopt

def winmungestr(s):
    "Duplicate of PuTTY's mungestr() in winstore.c:1.10 for Registry keys"
    candot = 0
    r = ""
    for c in s:
        if c in ' \*?%~' or ord(c)<ord(' ') or (c == '.' and not candot):
            r = r + ("%%%02X" % ord(c))
        else:
            r = r + c
        candot = 1
    return r

def strtolong(s):
    "Convert arbitrary-length big-endian binary data to a Python long"
    bytes = struct.unpack(">%luB" % len(s), s)
    return reduce ((lambda a, b: (long(a) << 8) + long(b)), bytes)

def longtohex(n):
    """Convert long int to lower-case hex.

    Ick, Python (at least in 1.5.2) doesn't appear to have a way to
    turn a long int into an unadorned hex string -- % gets upset if the
    number is too big, and raw hex() uses uppercase (sometimes), and
    adds unwanted "0x...L" around it."""

    plain=string.lower(re.match(r"0x([0-9A-Fa-f]*)l?$", hex(n), re.I).group(1))
    return "0x" + plain

output_type = 'windows'

try:
    optlist, args = getopt.getopt(sys.argv[1:], '', [ 'win', 'unix' ])
    if filter(lambda x: x[0] == '--unix', optlist):
        output_type = 'unix'
except getopt.error, e:
    sys.stderr.write(str(e) + "\n")
    sys.exit(1)

if output_type == 'windows':
    # Output REG file header.
    sys.stdout.write("""REGEDIT4

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]
""")

# Now process all known_hosts input.
for line in fileinput.input(args):

    try:
        # Remove leading/trailing whitespace (should zap CR and LF)
        line = string.strip (line)

        # Skip blanks and comments
        if line == '' or line[0] == '#':
            raise "Skipping input line"

        # Split line on spaces.
        fields = string.split (line, ' ')

        # Common fields
        hostpat = fields[0]
        magicnumbers = []   # placeholder
        keytype = ""        # placeholder

        # Grotty heuristic to distinguish known_hosts from known_hosts2:
        # is second field entirely decimal digits?
        if re.match (r"\d*$", fields[1]):

            # Treat as SSH-1-type host key.
            # Format: hostpat bits10 exp10 mod10 comment...
            # (PuTTY doesn't store the number of bits.)
            magicnumbers = map (long, fields[2:4])
            keytype = "rsa"

        else:

            # Treat as SSH-2-type host key.
            # Format: hostpat keytype keyblob64 comment...
            sshkeytype, blob = fields[1], base64.decodestring (fields[2])

            # 'blob' consists of a number of
            #   uint32    N (big-endian)
            #   uint8[N]  field_data
            subfields = []
            while blob:
                sizefmt = ">L"
                (size,) = struct.unpack (sizefmt, blob[0:4])
                size = int(size)   # req'd for slicage
                (data,) = struct.unpack (">%lus" % size, blob[4:size+4])
                subfields.append(data)
                blob = blob [struct.calcsize(sizefmt) + size : ]

            # The first field is keytype again, and the rest we can treat as
            # an opaque list of bignums (same numbers and order as stored
            # by PuTTY). (currently embedded keytype is ignored entirely)
            magicnumbers = map (strtolong, subfields[1:])

            # Translate key type into something PuTTY can use.
            if   sshkeytype == "ssh-rsa":   keytype = "rsa2"
            elif sshkeytype == "ssh-dss":   keytype = "dss"
            else:
                raise "Unknown SSH key type", sshkeytype

        # Now print out one line per host pattern, discarding wildcards.
        for host in string.split (hostpat, ','):
            if re.search (r"[*?!]", host):
                sys.stderr.write("Skipping wildcard host pattern '%s'\n"
                                 % host)
                continue
            elif re.match (r"\|", host):
                sys.stderr.write("Skipping hashed hostname '%s'\n" % host)
                continue
            else:
                m = re.match (r"\[([^]]*)\]:(\d*)$", host)
                if m:
                    (host, port) = m.group(1,2)
                    port = int(port)
                else:
                    port = 22
                # Slightly bizarre output key format: 'type@port:hostname'
                # XXX: does PuTTY do anything useful with literal IP[v4]s?
                key = keytype + ("@%d:%s" % (port, host))
                value = string.join (map (longtohex, magicnumbers), ',')
                if output_type == 'unix':
                    # Unix format.
                    sys.stdout.write('%s %s\n' % (key, value))
                else:
                    # Windows format.
                    # XXX: worry about double quotes?
                    sys.stdout.write("\"%s\"=\"%s\"\n"
                                     % (winmungestr(key), value))

    except "Unknown SSH key type", k:
        sys.stderr.write("Unknown SSH key type '%s', skipping\n" % k)
    except "Skipping input line":
        pass

在 Win7x64 和 Python 2.7 上测试。

然后运行:

ssh-keyscan -t rsa bitbucket.org >>~/.ssh/known_hosts
python --win known_hosts.py >known_hosts.reg
start known_hosts.reg

并选择导入到注册表中。 keyscan 将检索域的公钥(我在使用 bitbucket 时遇到了问题),然后 python 脚本将其转换为 Plink 格式。

Solution with Plink

Save this python script to known_hosts.py:

#! /usr/bin/env python

# $Id$
# Convert OpenSSH known_hosts and known_hosts2 files to "new format" PuTTY
# host keys.
#   usage:
#     kh2reg.py [ --win ] known_hosts1 2 3 4 ... > hosts.reg
#       Creates a Windows .REG file (double-click to install).
#     kh2reg.py --unix    known_hosts1 2 3 4 ... > sshhostkeys
#       Creates data suitable for storing in ~/.putty/sshhostkeys (Unix).
# Line endings are someone else's problem as is traditional.
# Developed for Python 1.5.2.

import fileinput
import base64
import struct
import string
import re
import sys
import getopt

def winmungestr(s):
    "Duplicate of PuTTY's mungestr() in winstore.c:1.10 for Registry keys"
    candot = 0
    r = ""
    for c in s:
        if c in ' \*?%~' or ord(c)<ord(' ') or (c == '.' and not candot):
            r = r + ("%%%02X" % ord(c))
        else:
            r = r + c
        candot = 1
    return r

def strtolong(s):
    "Convert arbitrary-length big-endian binary data to a Python long"
    bytes = struct.unpack(">%luB" % len(s), s)
    return reduce ((lambda a, b: (long(a) << 8) + long(b)), bytes)

def longtohex(n):
    """Convert long int to lower-case hex.

    Ick, Python (at least in 1.5.2) doesn't appear to have a way to
    turn a long int into an unadorned hex string -- % gets upset if the
    number is too big, and raw hex() uses uppercase (sometimes), and
    adds unwanted "0x...L" around it."""

    plain=string.lower(re.match(r"0x([0-9A-Fa-f]*)l?$", hex(n), re.I).group(1))
    return "0x" + plain

output_type = 'windows'

try:
    optlist, args = getopt.getopt(sys.argv[1:], '', [ 'win', 'unix' ])
    if filter(lambda x: x[0] == '--unix', optlist):
        output_type = 'unix'
except getopt.error, e:
    sys.stderr.write(str(e) + "\n")
    sys.exit(1)

if output_type == 'windows':
    # Output REG file header.
    sys.stdout.write("""REGEDIT4

[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]
""")

# Now process all known_hosts input.
for line in fileinput.input(args):

    try:
        # Remove leading/trailing whitespace (should zap CR and LF)
        line = string.strip (line)

        # Skip blanks and comments
        if line == '' or line[0] == '#':
            raise "Skipping input line"

        # Split line on spaces.
        fields = string.split (line, ' ')

        # Common fields
        hostpat = fields[0]
        magicnumbers = []   # placeholder
        keytype = ""        # placeholder

        # Grotty heuristic to distinguish known_hosts from known_hosts2:
        # is second field entirely decimal digits?
        if re.match (r"\d*$", fields[1]):

            # Treat as SSH-1-type host key.
            # Format: hostpat bits10 exp10 mod10 comment...
            # (PuTTY doesn't store the number of bits.)
            magicnumbers = map (long, fields[2:4])
            keytype = "rsa"

        else:

            # Treat as SSH-2-type host key.
            # Format: hostpat keytype keyblob64 comment...
            sshkeytype, blob = fields[1], base64.decodestring (fields[2])

            # 'blob' consists of a number of
            #   uint32    N (big-endian)
            #   uint8[N]  field_data
            subfields = []
            while blob:
                sizefmt = ">L"
                (size,) = struct.unpack (sizefmt, blob[0:4])
                size = int(size)   # req'd for slicage
                (data,) = struct.unpack (">%lus" % size, blob[4:size+4])
                subfields.append(data)
                blob = blob [struct.calcsize(sizefmt) + size : ]

            # The first field is keytype again, and the rest we can treat as
            # an opaque list of bignums (same numbers and order as stored
            # by PuTTY). (currently embedded keytype is ignored entirely)
            magicnumbers = map (strtolong, subfields[1:])

            # Translate key type into something PuTTY can use.
            if   sshkeytype == "ssh-rsa":   keytype = "rsa2"
            elif sshkeytype == "ssh-dss":   keytype = "dss"
            else:
                raise "Unknown SSH key type", sshkeytype

        # Now print out one line per host pattern, discarding wildcards.
        for host in string.split (hostpat, ','):
            if re.search (r"[*?!]", host):
                sys.stderr.write("Skipping wildcard host pattern '%s'\n"
                                 % host)
                continue
            elif re.match (r"\|", host):
                sys.stderr.write("Skipping hashed hostname '%s'\n" % host)
                continue
            else:
                m = re.match (r"\[([^]]*)\]:(\d*)$", host)
                if m:
                    (host, port) = m.group(1,2)
                    port = int(port)
                else:
                    port = 22
                # Slightly bizarre output key format: 'type@port:hostname'
                # XXX: does PuTTY do anything useful with literal IP[v4]s?
                key = keytype + ("@%d:%s" % (port, host))
                value = string.join (map (longtohex, magicnumbers), ',')
                if output_type == 'unix':
                    # Unix format.
                    sys.stdout.write('%s %s\n' % (key, value))
                else:
                    # Windows format.
                    # XXX: worry about double quotes?
                    sys.stdout.write("\"%s\"=\"%s\"\n"
                                     % (winmungestr(key), value))

    except "Unknown SSH key type", k:
        sys.stderr.write("Unknown SSH key type '%s', skipping\n" % k)
    except "Skipping input line":
        pass

Tested on Win7x64 and Python 2.7.

Then run:

ssh-keyscan -t rsa bitbucket.org >>~/.ssh/known_hosts
python --win known_hosts.py >known_hosts.reg
start known_hosts.reg

And choose to import into the registry. The keyscan will retrieve the public key for the domain (I had my problems with bitbucket), and then the python script will convert it to Plink format.

拥抱我好吗 2024-10-23 12:46:44

遇到同样的问题,并且忘记连接到实际存储库所在的端口上的 SSH,而不仅仅是一般的 SSH 端口,那么主机密钥就不同了!

Had the same issue, and forget to connect to SSH on port where is actuall repository, not just general SSH port, then the host key is different!

千鲤 2024-10-23 12:46:44

只需打开 Putty 并尝试与您想要推送代码的远程服务器建立连接。
当对话框出现时,按“是”(您信任远程),然后一切都会好起来。

Just open Putty and try to establish connection to remote server you want to push your code.
when the dialog appears press Yes(you trust remote) then everything would be OK.

画骨成沙 2024-10-23 12:46:44

工作环境:

  • Windows 10
  • git
  • putty

第一:根据Regedit删除registy中的puttyknown_hosts。
然后:在Window的cmd中执行命令%GIT_SSH% user@hostname即可解决问题。

希望对大家有所帮助。

Working environment:

  • Windows 10
  • git
  • putty

First: Delete putty known_hosts in registy according to the Regedit.
Then: Executing the command %GIT_SSH% user@hostname in Window's cmd solves the problem.

Hope it helps you all.

深陷 2024-10-23 12:46:44

正如 Roman Starkov 的回答,plink 需要将主机添加到其缓存中。

对于使用 Git Extensions 的人:

  1. 打开 Git Extensions
  2. 转到“工具”->“设置-> SSH
  3. 将路径复制到“plink.exe”(如果使用 PuTTY)/“klink.exe”(如果使用 KiTTY)
  4. 在控制台中,运行以下命令:(

替换为实际路径)

<the path to plink/klink.exe> <address to the server>

例如

%ProgramData%\chocolatey\lib\kitty\tools\klink.exe codebasehq.com

注意:确保使用与 Git 扩展相同的 plink/klink!

As answered by Roman Starkov, plink needs to add the host to it's cache.

For people using Git Extensions:

  1. Open Git Extensions
  2. Go to Tools -> Settings -> SSH
  3. Copy the path to "plink.exe" (if using PuTTY) / "klink.exe" (if using KiTTY)
  4. In a console, run the following command:

(replace with the actual paths)

<the path to plink/klink.exe> <address to the server>

e.g.

%ProgramData%\chocolatey\lib\kitty\tools\klink.exe codebasehq.com

Note: Make sure to use the same plink/klink that Git Extensions is using!

腻橙味 2024-10-23 12:46:44

当我尝试在 Windows 7 计算机上克隆存储库时,我也遇到了同样的问题。我尝试了这里提到的大部分答案。他们都不为我工作。

对我有用的是运行Pageant(Putty 身份验证代理)程序。一旦选美在后台运行,我就能够克隆、推送和复制。从存储库拉取/拉取到存储库。这对我有用,可能是因为我已经设置了我的公钥,以便每当第一次使用它时都需要密码&选美比赛开始。

I too had the same issue when I was trying to clone a repository on my Windows 7 machine. I tried most of the answers mentioned here. None of them worked for me.

What worked for me was, running the Pageant (Putty authentication agent) program. Once the Pageant was running in the background I was able to clone, push & pull from/to the repository. This worked for me, may be because I've setup my public key such that whenever it is used for the first time a password is required & the Pageant starts up.

可爱暴击 2024-10-23 12:46:44

从 PuTTY 更改为 OpenSSH 为我解决了这个问题,无需取消设置 GIT_SSH 等。

Changing from PuTTY to OpenSSH fixed this issue for me, without needing to unset GIT_SSH, etc.

╭⌒浅淡时光〆 2024-10-23 12:46:44

我使用这个 解决方法

您只需切换到嵌入式 Git,按下“是”按钮,然后切换回系统 Git。

您可以在以下位置找到此选项

Tools -> Options -> Git

I solved similar problem using this workaround.

You just have to switch to Embedded Git, push, press Yes button and then switch back to System Git.

You can find this option in

Tools -> Options -> Git
烈酒灼喉 2024-10-23 12:46:44

直接使用 Bash 添加主机并没有解决问题,在 Git 扩展中使用“Fetch all”时仍然出现错误。通过在一个分支上使用“拉取”,Git 扩展会通过 Bash 弹出屏幕自动添加所需的主机。完成此操作后,我可以再次使用“获取全部”。不确定 Git 扩展有何不同。

Adding the host directly with Bash didn't solve the issue, the error still occurred when using 'Fetch all' in Git Extensions. By using 'Pull' on one branch, the required host was added automatically by Git Extensions with a Bash pop-up screen. After doing this I was able to use 'Fetch All' again. Not sure what is done by Git Extensions differently.

坏尐絯℡ 2024-10-23 12:46:44

我已经尝试了上述所有方法,但没有一个可以解决我的笔记本电脑上的相同问题。最后,我没有在 git bash 中将分支推送到原点,而是使用 TortoiseGit 的推送选项来进行推送,然后弹出一个窗口,要求我将新的主机密钥添加到缓存中,单击“是”按钮后,一切都会进行现在好了。

希望对大家有所帮助。

I have tried all the methods above but none of them could fix the same issue on my laptop. Finally instead of pushing the branch to origin in git bash, I trun to use TortoiseGit's push option to do the pushing, then a window pops-up to ask me to add the new host key to cache, after clicking the yes button, everything goes fine now.

Hope it helps to you all.

給妳壹絲溫柔 2024-10-23 12:46:44

我换了硬盘,安装了Windows。当尝试上传文件时收到此命令窗口。

我按“y”,然后按 Ctrl + C。打开 putty.exe,添加一个旧密钥,然后返回到 git 并推送文件。

I changed a hard disk, installed Windows. When tried to upload files received this command window.

I pressed "y", then Ctrl + C. Opened putty.exe, added an old key ther returned to git and pushed files.

木緿 2024-10-23 12:46:44

在 Windows 7 或 10 中,对我有用的技巧是删除 GIT_SSH 系统变量。之前设置使用Plink,现在换成了Putty。这导致了 Plink.exe 错误

。由于 PC 是 64 位操作系统,因此还安装了旧的 Git(32 位版本)并更新到 Git(例如 Git-2.20.1-64-bit.exe)。

不管怎样,Putty/Plink 甚至没有被 Git 使用,因为在 Git 安装中它默认使用 Open SSH。

In Windows 7 or 10, the trick that worked for me is deleting the GIT_SSH system variable. It was set before to use Plink, and now was replaced by Putty. This was causing Plink.exe error

There was also an old installation of Git (32-bit version) and updating to Git(e.g. Git-2.20.1-64-bit.exe) since the PC was 64-bit OS.

Anyway the Putty/Plink was not even used by Git since in the Git installation it was default to use Open SSH.

倚栏听风 2024-10-23 12:46:44

我更改了 SSH 密钥,就发生了这种情况。
我尝试了一些解决方案,但失败了,放弃了。
最后,我选择 OpenSSH 而不是 PuTTY,然后就可以了:)

I changed my SSH key and this happend.
I tried some solution but it failed, and give up.
Finally, I select the OpenSSH instead of PuTTY, then it works :)

清晨说晚安 2024-10-23 12:46:44

只需卸载 Git 扩展并通过选择 OpenSSH 而不是再次安装

Just uninstall Git Extensions and Install again by choosing OpenSSH instead of

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文