【问题标题】:How can I use git with ssh on bitbucket如何在 bitbucket 上使用 git 和 ssh
【发布时间】:2016-12-27 06:57:09
【问题描述】:

我想通过 ssh 连接在 bitbucket 上使用 git,但 git clone 返回致命错误。

我创建了一个名为 sshtest 的存储库,并且我确定使用了正确的 ssh 密钥,因为我使用以下 ssh 命令确认它。

你有什么想法可以提出这个错误吗?

$ ssh -T git@bitbucket.org # show nothing
$ ssh git@bitbucket.org 
PTY allocation request failed on channel 0
logged in as username.

You can use git or hg to connect to Bitbucket. Shell access is disabled.
Connection to bitbucket.org closed.

$ git clone git@bitbucket.org:username/sshtest.git
Cloning into 'sshtest'...
fatal: Could not read from remote repository.

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

【问题讨论】:

    标签: git macos ssh


    【解决方案1】:

    我用我自己的 Bitbucket 帐户、测试存储库和密钥复制了您概述的步骤,并且没有任何问题:

    [ville@UBUNTU16-ORBITER:~/Projects] [16:37 CST]
    # git clone git@bitbucket.org:vwal/testrepo.git            
    Cloning into 'testrepo'...
    Enter passphrase for key '/home/ville/.ssh/keys/gitkey/gitkey': 
    remote: Counting objects: 65, done.
    remote: Compressing objects: 100% (36/36), done.
    remote: Total 65 (delta 17), reused 0 (delta 0)
    Receiving objects: 100% (65/65), 4.85 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (17/17), done.
    [ville@UBUNTU16-ORBITER:~/Projects] [16:38 CST]
    

    这让我认为您在 Bitbucket 端的存储库访问设置仍然存在问题(配置用户后,您将能够连接到 Bitbucket - 就像在您的测试中一样 - 但不能连接到特定的存储库)。您确定您已为访问用户名提供了对 Bitbucket 中 sshtest 存储库的足够访问权限吗?为此,您可以转到 Bitbucket 中的存储库,然后选择设置 > 用户和组访问权限,并为访问用户名提供至少 read 访问权限。

    【讨论】:

    • 感谢您提供的信息。 sshtest 存储库是我自己的存储库,所以我有管理员权限并且设置说“用户名已经有访问权限”。奇怪的是,我可以通过带有 ssh 身份验证的 sourcetree 从 Windows 克隆存储库。
    猜你喜欢
    • 1970-01-01
    • 2020-03-20
    • 2016-07-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-10
    • 2012-10-25
    • 2016-11-19
    相关资源
    最近更新 更多