【问题标题】:Command git ls-remote times out on Bitbucket, git clone works命令 git ls-remote 在 Bitbucket 上超时,git clone 工作
【发布时间】:2014-07-14 14:44:09
【问题描述】:

我正在尝试使用 Capistrano 设置自动部署配置,但是当 Capistrano 尝试运行该命令时,我不断失败

git ls-remote -h git@bitbucket.org:vendor/repo.git

该用户的 SSH 密钥已在 Bitbucket 中正确设置,因为我可以在该服务器内对该用户执行 git clone git@bitbucket.org:vendor/repo.git 而不会出现问题。

我还在登台服务器之外测试了命令 ls-remote,在我日常使用 Git 的普通开发机器中,我发现它在 Bitbucket 上也不起作用(我的开发机器中的 SSH 密钥显然已设置好并且可以正常工作)。

实际输出为:

git ls-remote -h ssh://git@bitbucket.org/vendor/repo.git
ssh: connect to host bitbucket.org port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

虽然我可以在相同的目录上执行 pushpull 没有任何问题。

Bitbucket 上的 ls-remote 命令是怎么回事?除了常规配置之外,我还应该进行一些额外的配置以使其正常工作吗?

【问题讨论】:

    标签: git ssh capistrano bitbucket


    【解决方案1】:

    正如here 解释的那样,我要做的就是将我的私钥添加到身份验证代理。首先,启动认证代理:

    $ eval `ssh-agent -s`
    

    列出可用键:

    $ ssh-add -l
    The agent has no identities.
    

    添加新密钥:

    $ ssh-add ~/.ssh/identity
    

    其中identity 是私钥文件,例如id_rsa。从现在开始,git ls-remote 命令开始正常工作。

    【讨论】:

    • 我已经完成了,我看到了关键但我仍然得到Connection timed out
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-05
    • 2023-02-21
    • 2011-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-06
    相关资源
    最近更新 更多