Just managed to get my hands on github, have created my repository long back, but hadn’t got time to push anything to it. Couple of days back, must give it a try and here I am, tried, worked and got answers for some of my weired questions, writing it so, it can help me later when redoing it and so to others who may face similar challenges.
I am not a hard developer, but then from the net understood git is a better version control system, than others. Hence, I will not go into how it begin and what it does, you sure can find a lot of documentation over the web.
So the quest begin from here.
1. How to create github repository.
A: I will tell you the only way I know. Following through the github’s manual this is how you can create a repostiroy in github.
2. Start working.
A: Create a pair of keys on your Linux Desktop/Laptop(mine is R61 running Lucid).
[code language=”bash”]
ssh-keygen -t rsa
[/code]
This will create a public and private key in your $HOME/.ssh/
You can then just copy the .pub file to your github account and save it there.
[code language=”text”]
Go to Account Settings > SSH Keys > and just copy and paste the content of your id_rsa.pub file in the space provided in the left and save it.
[/code]
3. Initialize your repository.
A: In your home area or your development area.
– This will initialize your repository where you are working.
[code language=”bash”]
git init .
[/code]
– To add files to your repository
[code language=”bash”]
git add * # To add all the files in that repo.
git add *.c # To add only the files with .c as extension, basically the source files.
git add filename # will add this only file to the repository
[/code]
– To add comment and move on.
[code language=”bash”]
git commit -a -m "add comment" # It could be anything from a short description of your changes to something elaborate.
[/code]
– To check the status of the chnaged files from the initial commit and a new commit.
[code language=”bash”]
git status
[/code]
Now, here comes the most intersting part. Putting your repository to github.com.
4. Comminting and uploading your work to github.
A: Initially all my push to the github was failing, later read somewhere that I need to make the pull request first and then the push will work, so here what i did/.
[code language=”bash”]
git pull http://github.com/omps/dotfiles.git # made my first pull to the repo.
[/code]
Inside my development env.
[code language=”bash”]
git init .
git remote add http://github.com/omps/dotfiles.git # Added my github repository to my local.
git remote -v # This will show you your push and pull origin.
[/code]
in my case it shows something like this
[code language=”bash”]
$ git remote -v
origin http://github.com/omps/dotfiles.git (fetch)
origin http://github.com/omps/dotfiles.git (push)
[/code]
now you are ready to make your first push with the files you added in step 3.
[code language=”bash”]
git push origin master
[/code]
Voilla!!! we are done.
Leave a Reply