簡體   English   中英

無法在Ubuntu上克隆來自bitbucket的repo

[英]can't clone repo from bitbucket on Ubuntu

我試圖在Ubuntu上克隆來自Bitbucket的回購,它失敗了:

fatal: https://user@bitbucket.org/owner/repo.git/info/refs not valid: is this a git repository?

但是,如果我在我的Mac上執行完全相同的命令,它工作正常。

我使用的命令是:

git clone https://user@bitbucket.org/owner/repo.git

在Ubuntu上可能出現什么問題?

使用ssh協議而不是http/https

使用http / https,每次必須與服務器“對話”時都必須輸入密碼。

使用ssh將使用ssh keys ,您不必每次都輸入用戶名密碼。

git clone git@bitbucket.org:owner/repo.git

Permission denied (publickey)

您收到此錯誤,因為您的任何平台上都沒有ssh密鑰。 設置密鑰,將它們添加到您的帳戶,您就可以了。


Create ssh keys

# create the key pair.
ssh-keygen -t rsa

# echo the key (pub) to the screen and copy it to clipboard
cat ~/.ssh/id_rsa.pub

Add the keys to your bitbucket account

  • 登錄您的Bitbucket帳戶
    從應用程序菜單中選擇頭像>設置。

  • 選擇SSH密鑰並粘貼您從第一步復制的密鑰

在此輸入圖像描述


注意:

在需要連接到帳戶的每台計算機上重復此步驟,或將相同的密鑰復制到所有計算機上。 兩種方式都有效。

我認為該命令可以是https

git clone https://bitbucket.org/owner/repo.git

或ssh

git clone git@bitbucket.org:owner/repo.git

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM