“GitHub is a Web-based Git repository hosting service. It offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features. Unlike Git, which is strictly a command-line tool, GitHub provides a Web-based graphical interface and desktop as well as mobile integration. It also provides access control and several collaboration features such as bug tracking, feature requests, task management, and wikis for every project.” – Wikipedia
To get started with Github, you have to create an account on Github.com. Once the account has been created, download the Git tool which is used to manipulate your repository.
Here are the steps which you need to follow :
Register on Github and download the Git tool. The git tool is the command “git” on your Linux machine.
Create a repository on the Github website. I am actually working on a project using this repository – TheTunnelix/Deploy
Now, you can start setting up git locally. Here are some commands which you need to remember:
git config –global user.name “TheTunnelix” – Setting up a username
git config –global user.email “[email protected]” – Configuring your mail address
git clone https://github.com:TheTunnelix/Deploy.git – Cloning your local machine with the Github Repo that you have created.
git status – You can use this command to understand the status of the repo. For example, the number of files which have not been committed yet.
git add README.md – When you add a file, you are now in between your local and the repository to proceed forward with the commit.
git commit -m “updated readme file for the better description” – This is a way to document the stage area to be ready to finalize the repo. It is not actually a commit. Use git commit -help. Remember, each commit has an ID so that you can roll back in time.
git remote add origin https://github.com:TheTunnelix/Deploy.git – If you did not clone a repo, you may need to use this command because when a repo is cloned, you have already added the origin.
git push -u origin master – the “u” option means saving for the origin master (the branch you are pushing to). It will prompt you to enter your username and password. You will notice the following message “Branch master set up to track remote branch master from origin” which means that things went well.
From the Github account, you will notice that the change has been carried out. Changes are done using the three principles ADD-COMMIT-PUSH. You cannot push without committing. If a new file is created locally and you use the git status command, it will prompt you the test file which you have created.
git add . – Another interesting command is the git add . where the dot means to add untracked files following to a git commit -m “test file is added” The “-m” means message. A git status will show you that there is nothing to commit and everything is clean. Each git push will prompt you to enter your username and password.
git pull -u origin master – This will pull all the content of the current repo.
There are also interesting options to explore on the Github website such as the branch/master. New branches can also be created. The graphs can be useful to view contributors on the project.