Rapid Docker on AWS

Video Course

4.2 Version control: git & CodeCommit

Reminder Temporary working environment
A short reminder of how to start your temporary working environment:
On Mac and Linux, open a terminal:
cd docker-on-aws-code && bash start.sh
On Windows, open PowerShell:
cd docker-on-aws-code; powershell -ExecutionPolicy ByPass -File start.ps1

Creating a Git repository

There is one thing, to consider before creating a Git reposiroty. The Git community decided to replace the default branch name master with main (see Regarding Git and Branch Naming).

Use the following command to make sure the default branch name is set to main:

git config --global init.defaultBranch main`

Next, initialize the repository.

git init

Showing the status of your repository

git status -uall

Adding all files to staging area

git add -A

Editing Git config

nano /root/.gitconfig

[user]
name = Your Name
email = you@example.com

Committing your staged changes

git commit -m "initial commit"

Creating CodeCommit repository

aws codecommit create-repository --repository-name php-basic

Configuring the remote repository

Replace $REPO_URL with the cloneUrlHttp output of the previous command.

git config credential.helper '!aws codecommit credential-helper $@'
git config credential.UseHttpPath true
git remote add origin $REPO_URL

Pushing your changes

git push -u origin master

Pulling changes from others

git pull