Wednesday, 8 May 2013

Git Config's && Clone's

I was thinking of making all my scripts to a centralized location so that I could access my code save it from any location which I access.

So I initially though of configuring CVS or SVN, however I majority of them move towards configuring git, I gave a try and configured successfully.

what differences led me to configure git?
Environment: CentOS 6

Assuming that everyone knows about the basic, below are the steps to configure

- Install your git client. 

- Create repository on your git server.

- Deploy your public keys to the git server. If you are not aware of it ( link: http://sunlnx.blogspot.in/2012/09/ssh-passwordless-linuxwindows.html)

- Initialize your git repository.
# git init

- Create a testfile and added it to your git repository.
# touch testfile
# git add testfile

- commit the changes made to your files.
# git commit -m "this was the first file after configurations of git repository"

- What commits are being made should be pushed to your remote repository called as origin, which are centralized. so when you are committing your repository, your client and the server establishes the trust for communication, that's the reason why you add your public key.

# git remote add origin git@github.com:username/reponame.git

- You can push your local commits to your master branch.
# git push -u origin master

Now when you refresh your username/reponame.git, you could see your files.

Git server is able to receive files/commits from the Git client.

- I assume as you have already read the document, Git has a special feature called cloning, which means I don't have to redo the above for configuring the same on other client. Instead I could simply clone my repository and will start to push our code to Git servers.

# git clone git@github.com:username/reponame.git

your repository would be downloaded in the $PWD directory.

Objective Successful