'clone AWS codecommit repo via HTTP
I have set 2 repositories in AWS Codecommit and using before SourceTree from Windows, setting up access via HTTP protocol was and everything was working fine.
Right not I am migrating the development of a project on a machine where I do have installed ubuntu and where I choose to use gitkraken.
I was able to git clone in a folder where my user has read and write access(my user) via Terminal, so isn't permission related in Ubuntu, where after git clone "aws repo url" I was prompt asking for the username for the IAM and password(the one created at AWS IAM console).
I can of course open that repo folder from gitkraken and see even all the remote branch and all the history, but once I do for example pull from gitkraken it failed as "access" denied. I cannot also clone the same or another repo from Gitkraken. So seems I do have to configure my credentials in gitkraken but not sure where that should be done. This official doc does not say much.
Solution 1:[1]
I actually found that I was able to connect, and previously I was failing because not following some steps quite hide in the AWS Codecommit docs:
I am not sure if giving the following at prompt are necessary steps, but I guess they do not hurt:
At terminal provide the following:
aws configure
you will be prompt to provide:
AWS Access Key ID
AWS Secret Access Key
Default region name
Default output format
Till here I do recommend to provide the above
After on clone "your https AWS address" your_repo_name, you are prompted to provide an username and a password. Unfortunately for both my root account and my IAM account(with correct rules policy) I got 403 error.
What was successful, without provide additional credential was to execute at terminal the following:
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
then simply:
clone https://your_url_code your_repo_name for HTTPS connection from AWS Codecommit console
For more detailed instruction refer to the official docs
This worked for me.
Solution 2:[2]
You can try to setup a SSH connection following this docs: https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html.
After that, open the repository with Gitkraken. When you try to pull or push, Gitkrake will ask you for credentials. Use the ssh credentials created on the previous step.
If Gitkraken fails again, check the file .git/config inside your local copy of the repository. I've noticed that the url created was incorrect, so check that the generated url matches the following pattern:
[remote "origin"]
url = ssh://<Your-SSH-Key-ID>@git-codecommit.<region>.amazonaws.com/v1/repos/<repo-name>
fetch = +refs/heads/*:refs/remotes/origin/*
Solution 3:[3]
While trying to clone aws repository to your local folder, make sure that region code of repository and default region code specified in your local aws CLI configure is same. Otherwise, it will give an error.
fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/coderepo/': The requested URL returned error: 403
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Community |
Solution 3 | vimuth |