I am sure many of you are familiar with Git version control system and github. Still I wish to share some very basic steps to keep a backup of your data. To put your data on github.com
Firstly you need to have an account on github.com.
1) This step is very simple. Just go to github.com and make an account by signing in there.
2) Just beside your username you can find a symbol, which helps you make you repository. Click on the icon. Write the name of the repository in the space provided under title “Repository name”, say SSSD. You can also write a simple description about the repository in the space provided under title “Description”.
3) Click on the button named “create repository” once 1 and 2(optional) step(s) are done.
Secondly you need to be familiar with some basic git commands. Lets us try putting a file on github.com as an example to understand it better.
1) Go to your terminal. Type : sudo yum install git (for fedora distribution) or type: sudo apt-get install git (for ubuntu users)
2) Now let us configure it.
git config –global user.name “user name”
git config –global user.email “email@example.com”
git config –global color.ui auto
3) Let us make a directory where we will have our file.
mkdir dir_name (say, mkdir testgit)
4) Type command : cd dir_name (say, cd testgit) and get into the directory.
5) Here one thing is to be done. We need to initiate a git repository to have git discovery across file systems.
So type the command : git init dir_name (say, git init trygit)
This command creates an empty Git repository – basically a .git directory with subdirectories for objects, refs/heads, refs/tags, and template files. An initial HEAD file that references the HEAD of the master branch is also created. More reference can be found here : http://git-scm.com/docs/git-init
cd dir_name (here in our example it is: cd trygit).
6) Let us now make our file. This is made inside “trygit” directory.
type: vi filename.txt2 (say, test2.txt)
7) Write some text (say, hello world) in file and save it.
See the status by typing: git status
you will see some msg like this:
# Untracked files:
# (use “git add <file>…” to include in what will be committed)
8) Once you make a file you need to add it keep track of your file and its changes.
To add file type: git add filename (say, git add test1.txt).
After adding you can see the status by typing: git status . The will see msg like this:
# On branch master
# Changes to be committed:
# (use “git reset HEAD …” to unstage)
# new file: test1.txt
9) Now we are going to commit the file.
type: git commit filename.txt (say, git commit test1.txt)
After this, a file will open where you can write a message and save it. Later you will see something like this on terminal
[master a98588d] testing git
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test1.txt
10) You can see all the the commits by using command: git log
11) Now let us push the file.
type: git push -u where what
“where” is the place you what to push the data. So for this copy paste the url where you had created the git repository on github.com.
“what” is, what you are pushing. Here in our example it is master.
so the command for this example will be: git push https://github.com/your_git_username/trygit.git master
Note: The name of repository can be different from the one we initiated in step 5.
12) As soon you are done with step 11 you will be asked for github.com username and password. Enter both and yipee we are done 🙂
Now you can check the pushed file in your repository on github 🙂
If you want to add some more files in the same repository just clone the repository and follow the same steps as mentioned above. In short:
1. git clone https://github.com/your_git_username/repository_created
2. Then add all the patch files to your cloned repo
git add *filenames
3. Then commit
git commit *filenames
4. Then push
git push where what
i.e git push https://github.com/your_git_username/repository_created master
Done! 🙂 🙂