Git: Setting Up the Repository and Doing an Initial Commit and Push

This is more a note to self to remember the steps needed to set up the local repository and doing an initial “push”.

git init

Creates the .git directory where Git stores the metadata and object database for your project.

git config --global "John Doe"
git config --global

Every Git commit uses the name and the email from the settings.

git config --list

Check your settings.

Add the lists of files that git should ignore in a .gitignore file.
Sample content:


git add .
git status

Add all files to the Staging Area.

git commit -m "Initial commit"

Commit your work (changes are saved in the local repository)

git remote add origin ""

Add a new remote Git repository

git push -u origin master

Push (changes are saved in the remote repository)

git tag -a v1.0.0 -m "version 1.0.0"
git push origin v1.0.0

Add a release version.

Post a Comment