cd ~/environment/MyDemoRepo
git init # initializes the git repository in this directory
git branch -m main # name the default brainch 'main'
git add Dockerfile spack.yaml # stage our files for commit
git commit -m "Created Dockerfile and spack files" # create a point-in-time commit
You can safely ingore git warnings about user.name and user.email not being set.
Next, you will use the AWS Command Line Interface (CLI) to create a Git repository in AWS CodeCommit where we can push our local git repository.
AWS CodeCommit is a secure, highly scalable, managed source control service that hosts private Git repositories.
aws codecommit create-repository --repository-name MyDemoRepo --repository-description "My demonstration repository" --tags Team=SC22
REPOURL=$(aws codecommit get-repository --repository-name MyDemoRepo --query repositoryMetadata.cloneUrlHttp --output text )
echo $REPOURL
Verify echo $REPOURL outputs a repo url like https://git-codecommit.<region>.amazonaws.com/v1/repos/MyDemoRepo
git remote add origin $REPOURL
Verify that the git remote is set correctly:
git remote -v
You should get output:
origin https://git-codecommit.<region>.amazonaws.com/v1/repos/MyDemoRepo (fetch)
origin https://git-codecommit.<region>.amazonaws.com/v1/repos/MyDemoRepo (push)
git push -u origin main
Verify that the CodeCommit and local repositories are synchronized with:
git fetch && git status
You should get output like:
...
On branch main
Your branch is up to date with 'origin/main'.
...