Article Outline:
- Pre-requisites
- Setup AWS Profile
-
Git Bash Setup
- Python Installation
- Installing git-remote-codecommit
- Error: git: 'remote-codecommit' is not a git command:
- Reconnect if Session Expired
- GitHub Desktop Setup
- Visual Studio Code Setup
- PyCharm Setup
- IDE Setup
Pre-requisites
- Ensure your SSO User has CodeCommit access
- You should have GitBash CLI installed on your machine
- Able to install Python preferably 3.12 version
- Able to install other software such git-remote-codecommit
NOTE: Please read carefully because after setup, you will NOT use the earlier URL: https://git.codecommit.us-east-1.amazonaws.com/
- Once the SSO session is established, the URL to use to clone is [codecommit://<profile name given in CLI above>@|codecommit://AdministratorAccess-735360830536@asg-admin]<CodeCommit repo name>
Setup AWS Profile
The second main feature we want to enable is AWS SSO login from the AWS Command Line Interface (AWS CLI) on our local machine.
- Run the following command from the AWS CLI. You need to enter the user portal URL from the previous step and tell the CLI what Region has your AWS SSO deployment. The following code example has AWS SSO deployed in us-east-1:
aws configure sso
SSO start URL [None]: https://asg-infra.awsapps.com/start/#
SSO region [None]:us-east-1
SSO registration scopes [sso:account:access:] LEAVE BLANK - HIT ENTER
- You will be redirected to your default browseror copy the link provided in your browser and ensure the code provided matches what is shown in CLI (will force you to log-in if not already) .
→
→
![]()
- In case you have access to more than 1 account, when you return to the CLI, you must choose your account (scroll with arrows). See below:
There are XX AWS accounts available to you.> XXAccess, infrastructure@acordsolutions.com (735360830536)> XXAccess, aws-infra@acordsolutions.com (971681912420)
- Choose the account with your CodeCommit repository:
735360830536account
Next, you see the permissions sets available to you in the account you just picked.
- You should see only 1 permission set, so will need to select the permission set.
You now see the options for the profile you’re creating for these AWS SSO permissions:
CLI default client Region [None]: us-east-1<ENTER>
CLI default output format [None]: json<ENTER>
CLI profile name [735360830536-Developer]: Dev-profile<ENTER>
Note:In GitBash, if you get error such as:

You can run the command from CMD or another WSL.
Git Bash Setup
Python Installation
To install Python on Git Bash, you'll need to follow these steps:
-
Step 1: Download Python
1. Go to the Python Downloads Page:
- Visit the official [Python downloads page](https://www.python.org/downloads/).
2. Download the Installer:
- Choose the latest version of Python for your operating system (Windows) and download the installer.
-
Step 2: Install Python
1. Run the Installer:
- Locate the downloaded installer file (usually in your Downloads folder) and double-click to run it.
2. Customize Installation:
- Check the box that says "Add Python to PATH". This is crucial as it allows you to use Python from the command line.
- Click on "Customize installation" for more options if needed.
3. Choose Optional Features:
- You can leave the default options checked. Click "Next".
4. Advanced Options:
- You can leave the default options or adjust as needed. Click "Install".
-
Step 3: Verify Python Installation
1. Open Git Bash:
- You can open Git Bash by searching for it in the Start menu or by finding it in the Git installation directory.
2. Check Python Version:
- In Git Bash, type the following command and press Enter
- You should see the version of Python that you installed.
-
Step 4: Install `pip`
`pip` usually comes bundled with Python, but if it's not available, you can install it manually.
1. Download `get-pip.py`:
- In Git Bash, run the following command to download the `get-pip.py` script:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
2. Run the `get-pip.py` Script:
- Execute the script using Python to install `pip`:
python get-pip.py
or
python3 get-pip.py
3. Verify `pip` Installation:
- To check if `pip` is installed correctly, run:
pip --version
or
pip3 --version
By following these steps, you should be able to install Python and `pip` on your system and use them from Git Bash.
Installing git-remote-codecommit
Finally, in Git Bash, we want to install the recently released git-remote-codecommit and start working with our Git repositories.
- Install git-remote-codecommit with the following code:
pip install git-remote-codecommit
With some operating systems, you might need to run the following code instead:
sudo pip install git-remote-codecommit
- Clone the code from one of your repositories.
git clone codecommit://<profile name given in CLI above>@<CodeCommit repo name>
Example:
git clone codecommit://AdministratorAccess-735360830536@asg-admin
Error: git: 'remote-codecommit' is not a git command:
If you are running into an error where it says git: 'remote-codecommit' is not a git command. Make sure to add your path to the environment variables.
Go to control panel → System Environment Variables → Choose Path and Click on EDIT.

Add the path where remote-codecommit is installed.
Example/Sample: C:\Users\{{YOUR-NAME}}\AppData\Roaming\Python\Python312\

Once added, Restart your Git Bash or IDE so it can reflect the changes.
Reconnect if Session Expired
Unlike IAM user, which had permanent Git access, the SSO session duration is 12 hours. So the users need to follow these steps to get a new session and be able to perform CodeCommit activities.
- In Git Bash or another WSL, run command: aws sso login --profile <profile name provided earlier>
Ex: aws sso login --profile AdministratorAccess-735360830536
- If you have forgotten the session, you can always put it from C:\Users\<UserName>\.aws\config
- Follow the steps where a URL will open and accept as shown:

GitHub Desktop Setup
- For GitHub Desktop, ensure that the setup is done and especially git-remote-codecommit is installed in Git Bash CLI as in above section.
- Follow the yellow highlighted to use Desktop:

Visual Studio Code Setup
- Similar to GitHub Desktop, for Visual Studio Code, ensure that the setup is done and especially git-remote-codecommit is installed in Git Bash CLI as in above section.
- Follow the highlights:

In URL just give codecommit://<profile name given in CLI above>@<CodeCommit repo name>
PyCharm Setup
- Open PyCharm IDE and navigate to the 3 vertical bars that will expand the menu
- Navigate to Git → Clone as shown:

- A screen similar to following one will be shown.
- Ensure that Repository URL and Git is selected.
- In URL, enter the same value as mentioned above i.e. codecommit://<profile name given in CLI above>@<CodeCommit repo name>
- Ensure that empty folder is selected
- This should clone the repo
Note: Do login to SSO using command:
aws sso login --profile AdministratorAccess-735360830536
IDE Setup
Note: Not all IDEs support the URL used by git-remote-codecommit during cloning. Clone the repository locally from the terminal or command line, and then add that local repo to your IDE.
Further details in AWS docs:- https://docs.aws.amazon.com/codecommit/latest/userguide/troubleshooting-grc.html#troubleshooting-grc-ide1
Comments
0 comments
Please sign in to leave a comment.