Copy and paste the following lines at the end of the
sam-app/.gitgnore file. There is no need to track the .aws-sam directory or the packaged.yaml under version control as they are re-generated on every build.
In Cloud9, remember to enable hidden files:
.gitignore file and paste the two lines described above.
From the root directory of your sam-app project, run the following commands:
cd ~/environment/sam-app git init git add . git commit -m "Initial commit"
Add your CodeCommit repository URL as a remote on your local git project.
git remote add origin codecommit://sam-app
If you typed the origin url incorrectly, you can remove it by running:
git remote rm origin.
Now, push the code:
git push -u origin master
Navigate to the AWS CodeCommit console, find your sam-app repository and click on it to view its contents. Make sure your code is there. You should see a screen like the following: