SSH git 克隆禁止用于 Windows 上的 Bitbucket



我正在设置 SSH 密钥以建立与我公司私人公司的 SSH 连接。但是我仍然无法克隆存储库。我正在使用 Windows 10。

  1. 我按照此链接中的 Windows 说明使用ssh-keygen命令生成密钥,https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html。

  2. 然后我也在 Bash 命令中运行以下命令

    $ eval $(ssh-agent) 
    
  3. 我为上述命令设置了私钥

    ssh-add ~/.ssh/<private_key_file>
    

一切都很顺利。然后,我将公钥id_rsa.pub密钥复制到带有标签的 Bitbucket SSH 密钥设置中。

克隆时,仍然收到以下错误。

Cloning into 'my-repo-les'...
ssh: connect to host bitbucket.org port 22: Network is unreachable
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

在源代码树中,我可以看到我的组织/公司的所有远程仓库。但是当我克隆时,我收到以下错误。

Command: git -c diff.mnemonicprefix=false -c core.quotepath=false ls-remote https://wai-yan-hein@bitbucket.org/lbresearch/frontendplatform.git
Output: 
Error: remote: Forbidden
fatal: unable to access 'https://wai-yan-hein@bitbucket.org/lbresearch/frontendplatform.git/': The requested URL returned error: 403

在我设置帐户之前。我用它来做Github。现在我为 Bitbucket 设置了。这可能是问题所在吗?

当我运行此命令时,连接已超时。

ssh -T hg@bitbucket.org

Bitbucket 还在备用端口上公开其 SSH 服务,以处理阻止端口 22 的网络(如您的网络)。尝试ssh -Tp443 hg@altssh.bitbucket.org- 该端口通常用于HTTPS,因此很少被阻止。

如果 altssh.bitbucket.org:443 返回您的用户名,则需要在克隆命令中使用不同的 URL 方案:git clone ssh://git@altssh.bitbucket.org:443/owner/repo.git

HTTP 状态 403 与您的 SSH 问题无关;该状态表示您能够访问 Bitbucket,并且您的凭据有效,但您无权执行您尝试执行的操作。

最新更新