Command "git archive" Failure

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Cloud のみ - この記事は、 クラウド プラットフォームのアトラシアン製品にのみ適用されます。

要約

When attempting to use the native git archive utility, some errors may appear, preventing the archive to complete.

環境

Bitbucket Cloud

Case #1 (SSH)

診断

An attempted archive may fail with the below "Cloud not resolve hostname" error.

git archive --output=outfile.txt --remote=ssh://git@bitbucket.org:atlassian/cloudtoken.git HEAD
ssh: Could not resolve hostname bitbucket.org:atlassian: Name or service not known
fatal: the remote end hung up unexpectedly

原因

This is caused by the format of the "remote" string containing two ":" characters. 

ソリューション

This can be resolved by adjusting the remote string to use either of the below syntaxes.

# Accepted formats:

git archive --output=outfile.txt --remote=ssh://git@bitbucket.org/atlassian/cloudtoken.git HEAD
# Continue to use the "ssh://" prefix and adjust the later ":" to a "/" between the hostname and your workspace ID

git archive --output=outfile.txt --remote=git@bitbucket.org:atlassian/cloudtoken.git HEAD
# Remove the "ssh://" prefix and use a ":" between the hostname and your workspae ID

Case #2 (HTTP)

診断

An attempted archive may fail with the below "operation not supported by protocol" error.

git archive --output=outfile.txt --remote=https://your-username@bitbucket.org/atlassian/cloudtoken.git HEAD
fatal: operation not supported by protocol

原因

The Bitbucket Cloud platform does not support git archive over the HTTP(s) protocol.

ソリューション

Use the SSH protocol as mentioned in Case #1 above instead

最終更新日: 2022 年 12 月 5 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.