BitBucket SSH Cloning Git

亡梦爱人 提交于 2020-01-25 08:52:06

问题


Following BitBucket docs: https://confluence.atlassian.com/bitbucket/clone-a-repository-223217891.html

This is the example code snippet of cloning using git. But when using the ":" I get an error of "could not resolve hostname" but when I use "/" I don't have any issues. What am I missing? Is the documentation incorrect?


$ git clone ssh://git@bitbucket.org:teamsinspace/documentation-tests.git
$ git clone ssh://git@bitbucket.org/teamsinspace/documentation-tests.git

回答1:


There are two different syntaxes for git SSH URLs:

ssh://git@bitbucket.org/teamsinspace/documentation-tests.git

and

git@bitbucket.org:teamsinspace/documentation-tests.git

See https://git-scm.com/docs/git-pull#_git_urls_a_id_urls_a

The Bitbucket docs mixed these two. This is an error in the docs.




回答2:


Note that every Bitbucket repo has a "Clone" button at the top right of the repo's home page. You can copy the correct git clone command from there.



来源:https://stackoverflow.com/questions/59035365/bitbucket-ssh-cloning-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!