AWS CodeCommit 现已不再向新客户提供。AWS CodeCommit 的现有客户可以继续正常使用该服务。了解更多
查看 CodeCommit 存储库详细信息
您可以使用 AWS CodeCommit 控制台、AWS CLI 或连接到 CodeCommit 存储库的本地存储库中的 Git 来查看有关可用存储库的信息。
在按照这些说明进行操作之前,请完成中的步骤设置
查看存储库详细信息(控制台)
使用 AWS CodeCommit 控制台可快速查看用您的 Amazon Web Services 账户创建的所有存储库。
-
打开 CodeCommit 控制台:https://console.aws.amazon.com/codesuite/codecommit/home
。 -
在存储库中,查看您登录的 AWS 区域中的存储库相关详细信息。使用区域选择器选择不同的 AWS 区域,以查看相应区域中的存储库。
选择您要查看更多详情的存储库的名称,然后执行以下操作之一:
-
要查看 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 命令。
例如,要查看有关别名为
origin的 CodeCommit 存储库的详细信息,请运行以下命令: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 用户详细信息页面上展开安全凭证。在 AWS CodeCommit 的 SSH 密钥中可找到 SSH 密钥 ID。
有关更多选项,请参阅 Git 文档。
查看 CodeCommit 存储库详细信息 (AWS CLI)
要使用 AWS CLI 命令操作 CodeCommit,请安装 AWS CLI。有关更多信息,请参阅 命令行参考。
要使用 AWS CLI 查看存储库详细信息,请运行以下命令:
-
要查看 CodeCommit 存储库名称及其相应 ID 的列表,请运行 list-repositories。
-
要查看有关单个 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 命令,并指定 CodeCommit 存储库的名称(使用
--repository-name选项)。提示
要获取 CodeCommit 存储库的名称,请运行 list-repositories 命令。
例如,要查看有关名为
MyDemoRepo的 CodeCommit 存储库的详细信息,请运行以下命令: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 存储库名称之间添加一个空格。提示
要获取 CodeCommit 中的存储库的名称,请运行 list-repositories 命令。
例如,要查看分别名为
MyDemoRepo和MyOtherDemoRepo的两个 CodeCommit 存储库的相关详情,请运行以下命令: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": [] } -