Command "git archive" failure due to "Cloud not resolve hostname" error

Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.

Summary

When attempting to use the native git archive utility, an SSH-related error "Cloud not resolve hostname" may appear, preventing the archive from completing.

Environment

Bitbucket Cloud

Diagnosis

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

Cause

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

Solution

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

Updated on September 26, 2025

Still need help?

The Atlassian Community is here for you.