You can create an github account inorder to avail a free online git repository service. It’s not as normal site registration. It contains many steps including the set up of passphrase and keys.
You can also set up a git repository in your system also. For that you need to install the git packages first. For installing git package in your ubuntu or other Debian based system, type the following command,
$ sudo apt-get install git-core
We need to set our username and email id.
$ git config --global user.name "Ajay Soman"
$ git config --global user.email firstname.lastname@example.org
Then you can create a git repository in the current directory.
$ git init
If want to add a corresponding file in the current directory,
$ git add filename
If you want to add all files then,
$ git add .
We cannot see the git repository in our current directory. It is hidden. Use ctrl+H to see the hidden files. Now commit all updates,
$ git commit -m 'first commit'
You can see the status of the repository to track the unstaged and updated files by the command,
$ git status
To see what you’ve changed but not yet staged, type git diff with no other arguments,
$ git diff
If you want to see what you’ve staged that will go into your next commit, you can use,
$ git diff –cached
To view the log of all the actions that are performed on the repository, use the following command,
$ git log
You can also clone a file from the github repository to own local machine. We need the exact URL of the online repository for that.
$ git clone url
These are the some basic commands that are used in Git to manage the files in it.