AWS CodeCommit本地克隆遇403错误,请求技术支持
Let’s walk through the most common fixes for this 403 issue—chances are one of these will get you up and running:
1. Verify Credential Setup (Helper + Correct Credentials)
First, make sure Git is configured to use the Windows credential manager to handle your CodeCommit credentials. Run this command in your terminal to check:
git config --global credential.helper
It should return manager-core (for newer Git versions) or wincred (older versions). If not, set it with:
git config --global credential.helper manager-core
Next, don’t use your regular IAM access key ID/secret access key when prompted for credentials. CodeCommit requires special HTTPS Git credentials generated specifically for your IAM user:
- Go to the IAM Console, select your user, navigate to the Security credentials tab.
- Scroll down to HTTPS Git credentials for AWS CodeCommit—generate a new pair if you haven’t already, and save the username/password (this is what you’ll enter when Git prompts you).
2. Check IAM Permissions
Your IAM user needs explicit permissions to access the CodeCommit repo. Double-check these settings:
- Attach a managed policy like
AWSCodeCommitPowerUserorAWSCodeCommitReadOnlyto your user (or the group they belong to). For minimal access, use a custom policy like this:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "codecommit:GitPull", "Resource": "arn:aws:codecommit:us-east-1:YOUR_ACCOUNT_ID:lambda-pipeline-repo" } ] } - Replace
YOUR_ACCOUNT_IDwith your actual AWS account ID, and confirm the region (us-east-1) and repo name match your setup.
3. Clear Stored Git Credentials
Windows Credential Manager might be caching old or incorrect credentials. Let’s reset that:
- Open Control Panel > Credential Manager > Windows Credentials.
- Look for any entries under Generic Credentials linked to
git-codecommit.us-east-1.amazonaws.com. - Delete those entries, then re-run the clone command and enter your valid HTTPS Git credentials when prompted.
4. Rule Out Proxy/Firewall Interference
Corporate networks often use proxies that block CodeCommit traffic. To test this:
- Try cloning the repo from a different network (like your home Wi-Fi). If it works, configure Git to use your corporate proxy:
git config --global http.proxy http://your-proxy-address:port - Ensure your proxy allows access to
git-codecommit.us-east-1.amazonaws.com.
5. Update Git to the Latest Version
Older Git versions can have compatibility issues with CodeCommit’s HTTPS setup. Run git --version in your terminal—if it’s older than 2.28, download and install the latest stable version.
6. Confirm Clone URL Accuracy
Double-check that your clone URL is correct:
- The region in the URL (
us-east-1) matches where your repo is hosted. - The repo name (
lambda-pipeline-repo) is spelled exactly as it appears in the CodeCommit console.
If none of these steps resolve the issue, share what you’ve tried so far and we can dig deeper!
内容的提问来源于stack exchange,提问作者sumanth shetty




