

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 更新儲存庫連結
<a name="repositorylinks-update"></a>

您可以使用 AWS Command Line Interface (AWS CLI) 中的 **update-repository-link**命令來更新指定的儲存庫連結。

您可以更新儲存庫連結的下列資訊：
+ `--connection-arn`
+ `--owner-id`
+ `--repository-name`

當您想要變更與儲存庫相關聯的連線時，可以更新儲存庫連結。若要使用不同的連線，您需要指定連線 ARN。如需檢視連線 ARN 的步驟，請參閱[檢視連線詳細資料](connections-view-details.md)。

**更新儲存庫連結**

1. 開啟終端機 (Linux、macOS 或 Unix) 或命令提示 (Windows)。使用 AWS CLI 執行 **update-repository-link**命令，指定儲存庫連結要更新的值。例如，下列命令會更新與儲存庫連結 ID 相關聯的連線。這會使用 `--connection` 參數指定新連線 ARN。

   ```
   aws codestar-connections update-repository-link --repository-link-id 6053346f-8a33-4edb-9397-10394b695173 --connection-arn arn:aws:codestar-connections:us-east-1:account_id:connection/aEXAMPLE-f055-4843-adef-4ceaefcb2167 
   ```

1. 此命令會傳回下列輸出。

   ```
   {
       "RepositoryLinkInfo": {
           "ConnectionArn": "arn:aws:codestar-connections:us-east-1:account_id:connection/aEXAMPLE-f055-4843-adef-4ceaefcb2167",
           "OwnerId": "owner_id",
           "ProviderType": "GitHub",
           "RepositoryLinkArn": "arn:aws:codestar-connections:us-east-1:account_id:repository-link/6053346f-8a33-4edb-9397-10394b695173",
           "RepositoryLinkId": "6053346f-8a33-4edb-9397-10394b695173",
           "RepositoryName": "MyRepo",
           "Tags": []
       }
   }
   ```