Content

Sunday, September 30, 2018

How to configure GitHub for first time use?

Github.com is an online enhanced version of Git.

Git is locally installed in each of your work stations. This is then used as a client connecting to the server version of git which is GitHub.com

In a way what you are doing is like an offline web application, you do all the work in your local computer and when you are done with the work, you sync up with the server. There is no need for Internet connection etc.

Git is usually installed in your laptop either by installed XCode in Mac


Go GitHub.com and register an account for yourself. It can range from a free account, a private account or a company account. The various description are given in GitHub.com

Once done on your laptop do the following

## This is required for making sure that all your commits done on a repository have the correct name
git config --global user.name "<Your GitHub.com Handle>"
git config --global user.email "<Your Email Address used for registering to GitHub.com"


## Create a new repository called GitHubHelloWorld in GitHub Online
## Create a Directory on the local computer
mkdir GitHubHelloWorld

move to the directory and give the following command
git init

# create a new file
readme.txt and edit the text

# add the file to git
git add readme.txt

# commit the file
git commit -m "Add readme.txt"

# Add a remote origin in preparation for pushing to GitHub.com.
# You need to add this only once
git remote add origin https://github.com/<youruseraccount>/GitHubHelloWorld.git

# Push the changes to GitHub.com under master. More on this later on the branching strategy
git push origin master


# Some useful commands
# Find all the files which are changed in Local which is not synced up with server
git status

# Short cut to add all files to git for the changes
git add --all

# Commit all the files
git commit -am "Initial Setup of Maven Project"


# If you don't want certain files to be in the repository, you need to add a .ignore file. This file would have the extensions or the file pattern you need to exclude from source control