- Create the new folder:
- Open a terminal or command prompt.
- Navigate to the desired location for the new folder using the
cd
command. - Create the new folder using the
mkdir
command, followed by the folder name:mkdir my-new-project
- Initiate a Git repository:
- Navigate into the newly created folder:
cd my-new-project
- Initialize a Git repository within the folder:
git init
- Navigate into the newly created folder:
- Add the remote CodeCommit repository:
- Use the
git remote add
command to specify the URL of the CodeCommit repository:git remote add origin https://your-codecommit-repository-url
- Replace
https://your-codecommit-repository-url
with the actual URL of your CodeCommit repository.
- Replace
- Use the
- Pull the code:
- Fetch the latest changes from the remote repository:
git fetch origin
- Merge the fetched changes into your local branch (usually
master
):git pull origin main
- Replace main with the name of the branch you want to pull if it’s different (e.g. master).
- Fetch the latest changes from the remote repository:
Now, the code from CodeCommit should be successfully pulled into your new folder!
Additional considerations:
- If you encounter authentication issues, configure your Git credentials for CodeCommit using the
git config
command. - If you need to create a new branch locally for your work, use
git checkout -b new-branch
. - Remember to commit and push your local changes back to CodeCommit as needed using
git commit
andgit push
.