Gunakan CreateRepository dengan AWS SDK atau CLI - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan CreateRepository dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanCreateRepository.

CLI
AWS CLI

Untuk membuat repositori

Contoh ini membuat repositori dan mengaitkannya dengan akun pengguna. AWS

Perintah:

aws codecommit create-repository --repository-name MyDemoRepo --repository-description "My demonstration repository"

Output:

{ "repositoryMetadata": { "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", "lastModifiedDate": 1444766838.027, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-1:111111111111EXAMPLE:MyDemoRepo", "accountId": "111111111111" } }
PowerShell
Alat untuk PowerShell

Contoh 1: Contoh ini membuat repositori baru dengan nama yang ditentukan dan deskripsi yang ditentukan.

New-CCRepository -RepositoryName MyDemoRepo -RepositoryDescription "This is a repository for demonstration purposes."

Output:

AccountId : 80398EXAMPLE Arn : arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo CloneUrlHttp : https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CloneUrlSsh : ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo CreationDate : 9/18/2015 4:13:25 PM DefaultBranch : LastModifiedDate : 9/18/2015 4:13:25 PM RepositoryDescription : This is a repository for demonstration purposes. RepositoryId : 43ef2443-3372-4b12-9e78-65c27EXAMPLE RepositoryName : MyDemoRepo
  • Untuk API detailnya, lihat CreateRepositorydi AWS Tools for PowerShell Referensi Cmdlet.