How to Update AWS Amplify After Renaming Your GitHub Repository
Here's a helpful guide for developers who need to update their Amplify app after renaming a GitHub repository: How to Update AWS Amplify After Renaming Your GitHub Repository When you rename a GitHub repository connected to AWS Amplify, your builds will fail because Amplify can't find the original repository. Here's a guide to fix this. Prerequisites Already have an app hosted in AWS Amplify GitHub account Step 1: Generate a GitHub Access Token Go to GitHub.com, sign in. Navigate to Settings → Developer settings → Personal access tokens → Tokens (classic) Click "Generate new token (classic)". Give it a descriptive name (e.g., "Amplify Repo Access") Select the repo scope. Click "Generate token" and copy it immediately (you won't see it again) Step 2: Find Your Amplify App ID Open the AWS Amplify ConsoleChange it to your region prefix Select your app, look for the app ID. It starts with 'd' followed by letters and numbers (e.g., d2x3uf5yeo5smt) Step 3: Update Repository Connection Open AWS CloudShell in your browser, click on the terminal on this page: Change it to your region prefix or your local terminal Run the following command, replacing the placeholders: aws amplify update-app \ --app-id YOUR_APP_ID \ --repository https://github.com/USERNAME/NEW-REPO-NAME \ --access-token YOUR_GITHUB_TOKEN Step 4: Verify the Connection Go back to the Amplify Console Check your app's build history Trigger a new build to verify the connection works Security Best Practices Revoke the GitHub token after successful connection if you won't need it again Never commit or share your GitHub access token Use the minimum required scopes for the token Troubleshooting If you encounter issues: Verify your app ID is correct Ensure the GitHub token has the correct permissions Check that the repository URL is exact (case-sensitive) Make sure you have admin access to both Amplify and the GitHub repository Important Notes This process doesn't affect your local development environment Your build settings and environment variables remain unchanged The GitHub repository history is preserved If you have multiple branches, they will all be reconnected automatically By following these steps, you can quickly update your Amplify app to point to your renamed GitHub repository without losing any configuration or deployment history.
Here's a helpful guide for developers who need to update their Amplify app after renaming a GitHub repository:
How to Update AWS Amplify After Renaming Your GitHub Repository
When you rename a GitHub repository connected to AWS Amplify, your builds will fail because Amplify can't find the original repository. Here's a guide to fix this.
Prerequisites
- Already have an app hosted in AWS Amplify
- GitHub account
Step 1: Generate a GitHub Access Token
- Go to GitHub.com, sign in. Navigate to Settings → Developer settings → Personal access tokens → Tokens (classic)
- Click "Generate new token (classic)". Give it a descriptive name (e.g., "Amplify Repo Access")
- Select the
repo
scope. Click "Generate token" and copy it immediately (you won't see it again)
Step 2: Find Your Amplify App ID
- Open the AWS Amplify ConsoleChange it to your region prefix
- Select your app, look for the app ID. It starts with 'd' followed by letters and numbers (e.g.,
d2x3uf5yeo5smt
)
Step 3: Update Repository Connection
- Open AWS CloudShell in your browser, click on the terminal on this page: Change it to your region prefix or your local terminal
- Run the following command, replacing the placeholders:
aws amplify update-app \
--app-id YOUR_APP_ID \
--repository https://github.com/USERNAME/NEW-REPO-NAME \
--access-token YOUR_GITHUB_TOKEN
Step 4: Verify the Connection
- Go back to the Amplify Console
- Check your app's build history
- Trigger a new build to verify the connection works
Security Best Practices
- Revoke the GitHub token after successful connection if you won't need it again
- Never commit or share your GitHub access token
- Use the minimum required scopes for the token
Troubleshooting
If you encounter issues:
- Verify your app ID is correct
- Ensure the GitHub token has the correct permissions
- Check that the repository URL is exact (case-sensitive)
- Make sure you have admin access to both Amplify and the GitHub repository
Important Notes
- This process doesn't affect your local development environment
- Your build settings and environment variables remain unchanged
- The GitHub repository history is preserved
- If you have multiple branches, they will all be reconnected automatically
By following these steps, you can quickly update your Amplify app to point to your renamed GitHub repository without losing any configuration or deployment history.