简体   繁体   English

如何在Bitbucket上将git与ssh一起使用

[英]How can I use git with ssh on bitbucket

I want to use git on bitbucket with ssh connection but git clone returns fatal error. 我想在ssh连接的bitbucket上使用git,但是git clone返回致命错误。

I created a repository named sshtest and I'm sure using correct ssh key because I confirm it with ssh commands like following. 我创建了一个名为sshtest的存储库,并且确定使用了正确的ssh密钥,因为我通过如下所示的ssh命令进行了确认。

Do you have some ideas to raise the error? 您是否有提出错误的想法?

$ 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.

I replicated the steps you outline with my own Bitbucket account, test repo, and key, and it worked without any problems: 我使用自己的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]

This leads me to think something is still wrong with your repository access settings on the Bitbucket side (with the user configured you'd be able to connect to Bitbucket – as in your test – but not to the specific repository). 这使我认为Bitbucket端的存储库访问设置仍然存在问题(通过配置用户,您可以像测试中一样连接到Bitbucket,但不能连接到特定的存储库)。 Are you sure you have given the accessing username sufficient access to the sshtest repository in Bitbucket? 您确定已为访问用户名授予对Bitbucket中sshtest存储库的足够访问权吗? You can do so by going to your repository in Bitbucket, then select Settings > User and group access , and give the accessing username at least read access. 为此,您可以转到Bitbucket中的存储库,然后选择“设置”>“用户和组访问” ,并为访问用户名提供至少读取访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM