If you have ever been active in the world of software development, you know the importance of keeping track of different versions of your project, which in turn helps you to keep that flow of development as well as to provide better usability. In addition, if you have ever approached experienced people in this field, they would prefer Git, in most cases. Technically speaking, Git is one widely used tool for distributed version control as well as source-code-management purposes with ease. On the other hand, GitHub is a hosting platform for software projects, which make use of Git for version controlling. So if you haven’t signed up for Github, we highly recommend you do so at https://github.com/signup/free.
All repositories in the basic plan of GitHub are public whereas you will have to purchase the premium plan for building private repositories. Rather than a hosting service, the service is something further useful, as it helps in building a community-level development as well as easy publicizing of your software-development projects, based on Git. When both these projects are combined together, it brings an awesome solution for the easy management of your projects. Earlier, we had published one tutorial for using Git in your Windows-powered PC. Now, it is time for Linux, which is also from the open-source power. Hope this tutorial will help you in setting up the special environment in your Linux PC and enabling version controlling in an effective manner.
Basics of Git
1. Creating a Repository
You can create a repository on Github, but you will need to be logged in on Github. If you don’t have an account, you can create one at github.com.
Here you need to provide a name for your repository, and some description. You can choose to make your repo Public or Private.
2. Set up Your Repository
Once, you have created the repo, Github will provide the instructions to setup your repo with on your local machine.
If you do not have Git setup on your machine, follow the instructions at https://help.github.com/articles/set-up-git. Now, let’s start with creating a directory and initializing Git.
Add a ‘index.php’ file to our directory.
< ?php echo "Hello git"; ?>
Now initialize the directory with:
$ git init
Add the files with:
$ git add
This will include all the files in our directory.
Now, let’s make our first commit with:
$ git commit -m "first commit"
Add the origin to our repository with:
$ git remote add origin [email protected]:bkvirendra/my-repo.git
Now lets, push the changes to our repository online:
$ git push
This will save all our local changes to our repository online.
That’s it, folks!
Please comment if you have any issues setting up Git on your local machine.
What people are saying
I just reached to your new Post How to use GitHub on Linux. I know why we use GitHub but I never use it before. I just follow up your tutorial that you have tried to described. Its really nice and easy to use with your tutorial.
Thanks for sharing useful tips and tutorial for new user of GitHub. Thanks again
Very nice tutorial
I tried linux only one time and its not a good experience for me
because you have to give too many commands…
Is their any article that can make Linux using easy
Then i can try Git…
Anyway really good article and it help newbies
Hey Sourya! The number of commands that you use on a Linux machine really depends on what you are trying to achieve, and the Linux distro you are making use of.
And since, you are trying out Git, it doesnt matter which Operating system you are working on. Since Git requires you to enter the same number of commands for performing tasks (including commit, push, merge, etc.)
And as you said, that you had to enter number of commands, can you please share the Linux distro you are worked on and what you were exactly trying to achieve?
It is Ubuntu OS
And i was trying to Root my Sony Xperia X10
with ADB & Fastboot
Rooting your device is totally a different task, and honestly it gets complicated on any OS (not just Linux).
Let me know, if you any query/ issue regarding using Git on Linux.
Thanks for your help…
Actually i am running a blog for rooting from last 8 months
I always try rooting method in Windows OS
A really nice post!
As we move towards the future we are using Linux distros more and more and also Github is an awesome place to get useful repos.
Nice post. Will come back for more.
I’ll keep this in mind when i decided to change my operating system to Linux. Right now I’m happy with Windows 8