2017-03-10 31 views
0

理想情況下,我想不使用git(使用curl命令),但如果必須使用git,則可以。如何創建一個用於從bitbucket下載私有存儲庫的批處理腳本?

我能爲與公共回購做到這一點:

curl -L "https://bitbucket.org/{username}/{repo}/get/{branch}.zip" > downloaded_file.zip 

我試圖this way一個私人倉庫,但沒有奏效。似乎這種方式不再受到支持。

我也試圖與:

curl -L -H "Authorization: Bearer {ACCESS_TOKEN}" https://bitbucket.org/{username}/{repo}/get/master.tar.gz 

我換成{} ACCESS_TOKEN通過在一個到位桶消費者的OAuth產生的關鍵,然後我試圖與祕密,但它沒有工作,任何方式。 (當我創建這個消費者時,我沒有檢查「這是一個私人消費者」字段)。當我在cmd中執行這個時,我得到一個損壞的zip文件。

我也嘗試過git clone [repo url].git,但它提示我輸入憑據,我想在腳本中指定憑據,以便它可以自動下載。

我迷路了,歡迎任何幫助。

+1

的[使用HTTP認證下載私人到位桶倉庫的zip文件]可能的複製(http://stackoverflow.com/questions/17682143/download-private-bitbucket- repository-zip-file-using-http-authentication) – TheGeorgeous

+0

正如[此評論]所示(http://stackoverflow.com/questions/17682143/download-private-bitbucket-repository-zip-file-using-http-authentication/17778114#comment51997727_17778114)bitbucket已棄用參考答案中的解決方案。這就是爲什麼我再次問這個問題 –

回答

0

我能做到這樣:

curl -L -u {user}:{pass} "https://bitbucket.org/{username}/{repo}/get/{branch}.zip" > downloaded_file.zip 
相關問題