2

有沒有什麼辦法可以將git中的文件直接上傳到谷歌雲存儲存儲桶?將文件從git傳輸到Google雲存儲存儲桶

我已經使用下面的命令嘗試:

gsutil cp https://Link.git gs://bucketname 

但它給了我一個錯誤:

InvalidUrlError: Unrecognized scheme "https".

有,我可以將內容上傳到這個任何其他方式?

任何幫助非常感謝!

回答

1

引擎蓋下偷看顯示,在google-cloud-sdk/platform/gsutil/gslib/storage_url.py的(可能)觸發錯誤消息你得:

def _GetSchemeFromUrlString(url_str): 
    """Returns scheme component of a URL string.""" 

    end_scheme_idx = url_str.find('://') 
    if end_scheme_idx == -1: 
    # File is the default scheme. 
    return 'file' 
    else: 
    return url_str[0:end_scheme_idx].lower() 

[...]

def StorageUrlFromString(url_str): 
    """Static factory function for creating a StorageUrl from a string.""" 

    scheme = _GetSchemeFromUrlString(url_str) 

    if scheme not in ('file', 's3', 'gs'): 
    raise InvalidUrlError('Unrecognized scheme "%s"' % scheme) 

基本上該工具不支持通用的URL。

當然 - 可以冒險提高工具,實際上支持從git回購直接複製。但應該指出的是,它只能在菊花鏈模式下工作。從Options

-D

Copy in "daisy chain" mode, i.e., copying between two buckets by hooking a download to an upload, via the machine where gsutil is run. This stands in contrast to the default, where data are copied between two buckets "in the cloud", i.e., without needing to copy via the machine where gsutil runs.

[...]

Note: Daisy chain mode is automatically used when copying between providers (e.g., to copy data from Google Cloud Storage to another provider).

但由於在這種情況下,數據必須通過運行gsutil本地機器它可能是簡單的只克隆本地git倉庫,然後使用未修改gsutil從本地回購上傳到桶:)