Andrea Daly : Making a New Git Repository from a Local Directory

Instructions here will enable set up of git repositories both on your local environment and remote repositories on personal gitLab accounts for pet projects or training purposes.

Create a New Git Repository from Local Directory

[pre-requisite: you have setup gitLab account to have an SSH key #ssh]

[pre-requisite: permission to add new projects to a namespace #group]

From New directory:

mkdir <project-dir>

cd <project-dir>

git init

From Exisiting directory:

cd <existing-dir>

git init

[action: put items you want to be tracked by git including a readme file at the root #bash:file-mgt]

touch README.md

git status

git add .

git commit -m <commit-msg>

Make new Remote Repository:

[pre-requisite: complete above steps]

git push --set-upstream git@gitlab.example.com:namespace/myproject.git master

[example: git push --set-upstream git@gitlab.com:andrea-sample-resources/git-lab-examples.git master]

[configure remote origin #connecting to remote]

[make and push changes to remote #adding changes]