本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
查看 CodeCommit 存储库详情
您可以使用连接到 CodeCommit 存储库的本地存储库中的Amazon CodeCommit控制台Amazon CLI、或 Git 来查看有关可用存储库的信息。
在按照这些说明进行操作之前,请完成设置 中的步骤。
查看存储库详细信息(控制台)
使用Amazon CodeCommit控制台快速查看使用您的亚马逊 Web Services 账户创建的所有存储库。
-
打开 CodeCommit 控制台,网址为 https://console.aws.amazon.com/codesuite/codecommit/home
。 -
在存储库中,选择存储库的名称。
请执行下列操作之一:
-
要查看 URL 来克隆存储库,请选择 Clone URL (克隆 URL),然后选择克隆存储库时要使用的协议。此时将复制克隆 URL。要查看它,请将其粘贴到纯文本编辑器中。
-
要查看仓库的可配置选项以及仓库 ARN 和仓库 ID 等详细信息,请在导航窗格中选择 “设置”。
-
注意
如果您以 IAM 用户身份登录,则可以配置和保存查看代码和其他控制台设置的首选项。有关更多信息,请参阅使用用户首选项:
查看 CodeCommit 仓库详情 (Git)
要使用本地存储库中的 Git 来查看 CodeCommit 存储库的详细信息,请运行git remote show命令。
在执行这些步骤之前,请将本地存储库连接到 CodeCommit 存储库。有关说明,请参阅 连接存储库。
-
运行git remote show
remote-name
命令,其中remote-name
是 CodeCommit 存储库的别名(默认为)。origin
提示
要获取 CodeCommit 仓库名称及其 URL 的列表,请运行该git remote -v命令。
例如,要查看别名为 CodeCommit 存储库的详细信息,请执行
origin
以下操作:git remote show origin
-
对于 HTTPS:
* remote origin Fetch URL: https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo Push URL: https://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo HEAD branch: (unknown) Remote branches: MyNewBranch tracked main tracked Local ref configured for 'git pull': MyNewBranch merges with remote MyNewBranch (up to date) Local refs configured for 'git push': MyNewBranch pushes to MyNewBranch (up to date) main pushes to main (up to date)
对于 SSH:
* remote origin Fetch URL: ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo Push URL: ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo HEAD branch: (unknown) Remote branches: MyNewBranch tracked main tracked Local ref configured for 'git pull': MyNewBranch merges with remote MyNewBranch (up to date) Local refs configured for 'git push': MyNewBranch pushes to MyNewBranch (up to date) main pushes to main (up to date)
提示
要查找您的 IAM 用户的 SSH 密钥 ID,请打开 IAM 控制台并展开 IAM 用户详细信息页面上的安全证书。在 Amazon CodeCommit 的 SSH 密钥中可找到 SSH 密钥 ID。
有关更多选项,请参阅您的 Git 文档。
查看 CodeCommit 存储库详细信息 (Amazon CLI)
要将Amazon CLI命令与一起使用 CodeCommit,请安装Amazon CLI。有关更多信息,请参阅命令行参考:
要使用 Amazon CLI 查看存储库详细信息,请运行以下命令:
-
要查看 CodeCommit 仓库名称及其对应 ID 的列表,请运行列表存储库。
-
要查看有关单个 CodeCommit 存储库的信息,请运行 get- repository。
-
要查看有关中多个存储库的信息 CodeCommit,请运行batch-get-repositories。
查看 CodeCommit 存储库列表
-
运行 list-repositories 命令:
aws codecommit list-repositories
您可以使用可选的
--sort-by
或--order
选项来更改返回信息的顺序。 -
如果成功,此命令将输出一个
repositories
对象,其中包含与 Amazon Web Services 账户 CodeCommit 关联的所有存储库的名称和 ID。下面是前面命令的一些示例输出:
{ "repositories": [ { "repositoryName": "MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE" }, { "repositoryName": "MyOtherDemoRepo", "repositoryId": "cfc29ac4-b0cb-44dc-9990-f6f51EXAMPLE" } ] }
查看有关单个 CodeCommit 存储库的详细信息
-
运行get-repository命令,使用
--repository-name
选项指定 CodeCommit 存储库的名称。提示
要获取 CodeCommit 存储库的名称,请运行列表存储库命令。
例如,要查看名为的 CodeCommit 存储库的详细信息
MyDemoRepo
:aws codecommit get-repository --repository-name MyDemoRepo
-
如果成功,此命令会输出一个包含以下信息的
repositoryMetadata
对象:-
存储库的名称 (
repositoryName
)。 -
存储库说明 (
repositoryDescription
)。 -
系统生成的存储库的唯一 ID (
repositoryId
)。 -
与存储库关联的 Amazon Web Services 账户的 ID (
accountId
)。
下面是前面示例命令的一些示例输出:
{ "repositoryMetadata": { "creationDate": 1429203623.625, "defaultBranch": "main", "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo", "lastModifiedDate": 1430783812.0869999, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-2:111111111111:MyDemoRepo", "accountId": "111111111111" } }
-
查看有关多个 CodeCommit 存储库的详细信息
-
使用 batch-get-repositories 选项运行
--repository-names
命令。在每个 CodeCommit 存储库名称之间添加一个空格。提示
要获取存储库的名称,请运行 list- CodeCommit repositories 命令。
例如,要查看名为
MyDemoRepo
和的两个 CodeCommit 存储库的详细信息,请执行MyOtherDemoRepo
以下操作:aws codecommit batch-get-repositories --repository-names MyDemoRepo MyOtherDemoRepo
-
如果成功,此命令会输出一个包含以下信息的对象:
-
找不到的所有 CodeCommit 存储库的列表 (
repositoriesNotFound
)。 -
CodeCommit 存储库列表 (
repositories
)。每个 CodeCommit 存储库名称后面都有:-
存储库说明 (
repositoryDescription
)。 -
系统生成的存储库的唯一 ID (
repositoryId
)。 -
与存储库关联的 Amazon Web Services 账户的 ID (
accountId
)。
-
下面是前面示例命令的一些示例输出:
{ "repositoriesNotFound": [], "repositories": [ { "creationDate": 1429203623.625, "defaultBranch": "main", "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo", "lastModifiedDate": 1430783812.0869999, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-2:111111111111:MyDemoRepo", "accountId": "111111111111" }, { "creationDate": 1429203623.627, "defaultBranch": "main", "repositoryName": "MyOtherDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyOtherDemoRepo", "lastModifiedDate": 1430783812.0889999, "repositoryDescription": "My other demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyOtherDemoRepo", "repositoryId": "cfc29ac4-b0cb-44dc-9990-f6f51EXAMPLE", "Arn": "arn:aws:codecommit:us-east-2:111111111111:MyOtherDemoRepo", "accountId": "111111111111" } ], "repositoriesNotFound": [] }
-