git initial setup code example

Example 1: set up git repository

# New local repository
git init
git add .
git commit -m "Initial commit"

# New remote repository
# Create remote repository (likely on github), then:
git remote add origin https://github.com/username/new_repo #https
git remote add origin [email protected]:username/new_repo #ssh
# Now push
git push -u origin master

Example 2: Macbook git user config global

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

Example 3: how to initialize a git repository command line

# New local repository
git init
git add .
git commit -m "Initial commit"

# New remote repository
git remote add origin [email protected]:username/new_repo #ssh
# Now push
git push -u origin master

Example 4: how to set up git user

$ git config --global user.name
> Mona Lisa

Example 5: git init

cd /path/to/my/codebase
git init   
git add .    
git commit -m "my comment"

Tags:

Misc Example