2014-03-31 84 views

回答

42

您可以用完整的HTTPS URL嘗試:

git clone https://username:[email protected]/*****/******.git 

如果省略https://一部分(用 ':' 而不是 '/'),它會被解釋像SSH URL。

GitHub的幫助頁「Which remote URL should I use?」確認的HTTPS URL可以訪問私有回購。

注:我不會直接把密碼的URL,但use a credential manager to get the right password for the right user

git clone https://[email protected]/*****/******.git 
+0

當啓用雙因素身份驗證,則需要生成一個臨時訪問令牌https://help.github.com/articles/which-remote-url-should-i-use/#when-2fa-is-enabled –

+1

@ mission.liao我同意。我在http://stackoverflow.com/a/18607931/6309中描述了PAT(個人訪問令牌) – VonC

11

只是爲了讓語法更清楚一點,克隆一個私人倉庫用途:

git clone https://[insert username]:[insert password]@github.com/[insert organisation name]/[insert repo name].git 

例子:

git clone https://myusername:[email protected]/myorgname/myreponame.git