Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini menjelaskan cara mendownload file individual dari repositori standar dan repositori jarak jauh Artifact Registry.
Repositori dapat berupa format artefak apa pun.
Mendownload file dapat berguna saat Anda ingin memasukkan file ke lingkungan lokal tanpa alat khusus format. Perhatikan bahwa Anda tetap harus
melakukan autentikasi ke Artifact Registry sebelum mendownload file.
File yang dapat didownload
Anda dapat mendownload setiap file data atau metadata yang ditemukan di repositori Anda.
Misalnya, repositori Maven akan menyimpan paket Java sebagai artefak. Setiap file dalam paket Java, seperti file jar dan file pom.xml, tersedia untuk didownload secara terpisah.
Penggunaan fitur ini tidak direkomendasikan untuk artefak yang sangat bergantung pada
alat klien untuk operasi download, seperti image Docker.
Untuk mendapatkan izin yang
Anda perlukan untuk mendownload file yang disimpan di repositori,
minta administrator Anda untuk memberi Anda
peran IAM Artifact Registry Reader (roles/artifactregistry.reader)
di repositori.
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Anda mungkin juga bisa mendapatkan
izin yang diperlukan melalui peran
khusus atau peran
bawaan lainnya.
Mencantumkan file
Anda dapat mencantumkan file di repositori untuk melihat file yang tersedia untuk didownload.
console
Buka halaman Repositories di konsol Google Cloud .
LOCATION: lokasi regional atau multi-regional
repositori.
REPOSITORY: nama repositori
tempat artefak disimpan.
DESTINATION: jalur ke
folder tujuan di sistem file lokal Anda. Folder tujuan harus sudah ada atau perintah akan gagal.
FILE: nama file yang dienkode URL. Anda dapat
menemukan nilai ini dengan menjalankan perintah gcloud
artifacts files list dan menyalin nilai untuk FILE. Harus
dikonversi ke format berenkode URL untuk perintah ini—misalnya, path/to/file.jar
harus dimasukkan sebagai path%2Fto%2Ffile.jar.
Metode HTTP dan URL:
GET https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media
Untuk mengirim permintaan, perluas salah satu opsi berikut:
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-18 UTC."],[[["\u003cp\u003eThis guide details the process of downloading individual files from both standard and remote Artifact Registry repositories, regardless of the artifact format.\u003c/p\u003e\n"],["\u003cp\u003eYou can list the available files within a repository using either the Google Cloud console or the \u003ccode\u003egcloud\u003c/code\u003e command-line tool, specifying project, repository, location, package, and version details as needed.\u003c/p\u003e\n"],["\u003cp\u003eTo download a file, the \u003ccode\u003egcloud artifacts files download\u003c/code\u003e command can be used, or a direct download link through an HTTP GET request.\u003c/p\u003e\n"],["\u003cp\u003eDownloading files requires prior authentication to Artifact Registry and having the "Artifact Registry Reader" IAM role.\u003c/p\u003e\n"],["\u003cp\u003eIt is not recommended to use the download feature for artifacts that heavily depend on client tooling, like Docker images.\u003c/p\u003e\n"]]],[],null,["# Download files\n\nThis page describes how to download individual files from Artifact Registry\n[standard](/artifact-registry/docs/repositories/create-repos) repositories and [remote](/artifact-registry/docs/repositories/remote-repo) repositories.\nThe repository can be of any artifact [format](/artifact-registry/docs/supported-formats).\n\nDownloading files can be useful when you want to get files into your local\nenvironment without format-specific tooling. Note that you must still\nauthenticate to Artifact Registry before downloading files.\n\nDownloadable files\n------------------\n\nYou can download any individual data or metadata file found in your repository.\nFor example, a Maven repository will store Java packages as artifacts. Any files\nwithin a Java package, such as jar files and pom.xml files, are individually\navailable for download.\n\nUsing this feature is not recommended for artifacts that depend heavily on\nclient tooling for download operations, such as Docker images.\n\nBefore you begin\n----------------\n\n- (Optional) [Set defaults for gcloud CLI\n commands](/artifact-registry/docs/repositories/gcloud-defaults).\n\n### Required roles\n\n\nTo get the permissions that\nyou need to download files stored in a repository,\n\nask your administrator to grant you the\n\n\n[Artifact Registry Reader](/iam/docs/roles-permissions/artifactregistry#artifactregistry.reader) (`roles/artifactregistry.reader`)\nIAM role on the repository.\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nYou might also be able to get\nthe required permissions through [custom\nroles](/iam/docs/creating-custom-roles) or other [predefined\nroles](/iam/docs/roles-overview#predefined).\n\nList files\n----------\n\nYou can list files in a repository to see what is available for download. \n\n### console\n\n\n1. Open the **Repositories** page in the Google Cloud console.\n\n [Open the Repositories page](https://console.cloud.google.com/artifacts)\n2. In the repository list, select the repository.\n\n3. Click the name of the package.\n\n4. To view downloadable files for all package versions, click the **Files**\n tab.\n\n5. To view downloadable files for a specific version of your package, click\n the version name, and then click the **Files** tab.\n\n### gcloud\n\n\nFor all the following commands, you can set a maximum number of files to return\nby adding the `--limit` flag to the command.\n\nTo list all files in the default project, repository, and\nlocation when the [default values are configured](/artifact-registry/docs/repositories/gcloud-defaults): \n\n gcloud artifacts files list\n\nTo list files in a specified project, repository, and location, run the command: \n\n gcloud artifacts files list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e \\\n --repository=\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\n\nTo list files for all versions of a specific package: \n\n gcloud artifacts files list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e \\\n --repository=\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --package=\u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e\n\nTo list files for a specific package version: \n\n gcloud artifacts files list \\\n --project=\u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e \\\n --repository=\u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e \\\n --location=\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --package=\u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e \\\n --version=\u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e\n\nReplace the following values:\n\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the regional or multi-regional [location](/artifact-registry/docs/repo-locations) of the repository.\n- \u003cvar translate=\"no\"\u003ePROJECT\u003c/var\u003e: your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects). If your project ID contains a colon (`:`), see [Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n- \u003cvar translate=\"no\"\u003eREPOSITORY\u003c/var\u003e: the name of the repository where the image is stored.\n- \u003cvar translate=\"no\"\u003ePACKAGE\u003c/var\u003e: the name of the package.\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e: the version of the package.\n\nFor Docker repositories, you can list files for a specific container image tag\nby adding the `--tag` flag to the command.\n\nFor more information, see\n[gcloud artifacts files list](/sdk/gcloud/reference/artifacts/files/list).\n\nDownload files\n--------------\n\nTo download individual files from a repository, run the following command: \n\n### gcloud\n\n\nBefore using any of the command data below,\nmake the following replacements:\n\n- \u003cvar class=\"edit\" scope=\"PROJECT\" translate=\"no\"\u003ePROJECT\u003c/var\u003e: your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects). If your project ID contains a colon (`:`), see [Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n- \u003cvar class=\"edit\" scope=\"LOCATION\" translate=\"no\"\u003eLOCATION\u003c/var\u003e: the regional or multi-regional [location](/artifact-registry/docs/repo-locations) of the repository.\n- \u003cvar class=\"edit\" scope=\"REPOSITORY\" translate=\"no\"\u003eREPOSITORY\u003c/var\u003e: the name of the repository where the artifact is stored.\n- \u003cvar class=\"edit\" scope=\"DESTINATION\" translate=\"no\"\u003eDESTINATION\u003c/var\u003e: the path to the destination folder in your local file system. The destination folder must already exist or the command will fail.\n- \u003cvar class=\"edit\" scope=\"FILE\" translate=\"no\"\u003eFILE\u003c/var\u003e: the full filename. You can find this value by running the [`gcloud artifacts\n files list`](/sdk/gcloud/reference/artifacts/files/list) command and copying the value for `FILE`.\n\n\nExecute the\n\nfollowing\n\ncommand:\n\n#### Linux, macOS, or Cloud Shell\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud artifacts files download \\\n --project=PROJECT \\\n --location=LOCATION \\\n --repository=REPOSITORY \\\n --destination=DESTINATION \\\n FILE\n```\n\n#### Windows (PowerShell)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud artifacts files download `\n --project=PROJECT `\n --location=LOCATION `\n --repository=REPOSITORY `\n --destination=DESTINATION `\n FILE\n```\n\n#### Windows (cmd.exe)\n\n**Note:** Ensure you have initialized the Google Cloud CLI with authentication and a project by running either [gcloud init](/sdk/gcloud/reference/init); or [gcloud auth login](/sdk/gcloud/reference/auth/login) and [gcloud config set project](/sdk/gcloud/reference/config/set). \n\n```bash\ngcloud artifacts files download ^\n --project=PROJECT ^\n --location=LOCATION ^\n --repository=REPOSITORY ^\n --destination=DESTINATION ^\n FILE\n```\nYou should see the download begin right away.\n\n\u003cbr /\u003e\n\n### API\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar class=\"edit\" scope=\"PROJECT\" translate=\"no\"\u003ePROJECT\u003c/var\u003e: your Google Cloud [project ID](/resource-manager/docs/creating-managing-projects#identifying_projects). If your project ID contains a colon (`:`), see [Domain-scoped projects](/artifact-registry/docs/docker/names#domain).\n- \u003cvar class=\"edit\" scope=\"LOCATION\" translate=\"no\"\u003eLOCATION\u003c/var\u003e: the regional or multi-regional [location](/artifact-registry/docs/repo-locations) of the repository.\n- \u003cvar class=\"edit\" scope=\"REPOSITORY\" translate=\"no\"\u003eREPOSITORY\u003c/var\u003e: the name of the repository where the artifact is stored.\n- \u003cvar class=\"edit\" scope=\"DESTINATION\" translate=\"no\"\u003eDESTINATION\u003c/var\u003e: the path to the destination folder in your local file system. The destination folder must already exist or the command will fail.\n- \u003cvar class=\"edit\" scope=\"ENC_FILE\" translate=\"no\"\u003eFILE\u003c/var\u003e: the url-encoded filename. You can find this value by running the [`gcloud\n artifacts files list`](/sdk/gcloud/reference/artifacts/files/list) command and copying the value for `FILE`. It must be converted to URL-encoded format for this command---for example, `path/to/file.jar` would need to be input as `path%2Fto%2Ffile.jar`.\n\n\nHTTP method and URL:\n\n```\nGET https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media\n```\n\nTo send your request, expand one of these options:\n\n#### curl (Linux, macOS, or Cloud Shell)\n\n\nExecute the following command:\n\n```\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n --output DESTINATION \\\n \"https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media\"\n```\n\n#### PowerShell (Windows)\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -OutFile DESTINATION `\n -Uri \"https://artifactregistry.googleapis.com/download/v1/projects/PROJECT/locations/LOCATION/repositories/REPOSITORY/files/FILE:download?alt=media\"\n```\nYou should see the download begin right away.\n\n\u003cbr /\u003e\n\nWhat's next\n-----------\n\n- [View and list repositories](/artifact-registry/docs/repositories/list-repos)\n- [Label repositories](/artifact-registry/docs/repositories/label-repos)\n- [Tag repositories](/artifact-registry/docs/repositories/tag-repos)\n- [Delete repositories](/artifact-registry/docs/repositories/delete-repos)"]]