Pages

Showing posts with label Version Control. Show all posts
Showing posts with label Version Control. Show all posts

Thursday, April 19, 2012

Installing and Setting Up Git in Ubuntu 11.10

With the new job I got to do so many new things and one of them was Git. Git is a distributed version control system. To know more about Git you can follow these links on wikipedia, git's web site and github. In this section I will use Git version 1.7.5.4.

Prior to Git I have worked on many version control systems such as CVS, SVN, Clear Case and MKS. Git, not gives a way to manage your repositories but you can also become social coder. Its social network on github.com makes it different and more interesting. Here we will see how to install git and configure it.

What you will need
  1. Git software including git-core*, git-gui
  2. Account in github.com. You can signup for free account in github.com
Install git
  1. Before installing check if git is already installed, open terminal and execute git command. You will see whether git is installed or not.
  2. Open Ubuntu Software Center, search git-core and install it.
  3. As shown in step 2, install git-gui from software center.
  4. Verify Git installation (git-gui).
  5. Open terminal and execute git command. You can check the version also as shown below using the command

Setup git
Now, I will setup github account.
  1. Open terminal, execute the command
    git --version
    
  2. Execute this command to generate SSH key
    ssh-keygen -t rsa -C "manohar.negi@komli.com" 
    
  3. Copy the contents of /.ssh/id_rsa.pub file
  4. Sign in to github account
  5. Account Settings --> add new ssh key with the value as the contents of id_rsa.pub file
  6. Test the connection
    ssh -T git@github.com
    
That's all. With this you will be able to use git.

Tuesday, April 17, 2012

Using multiple git accounts in a machine

Problem statement: I have two git-hub accounts, one I use for office work and the other is for my personal work. As per the git documentation, I am able to configure them on my machine, but I can access only one at a time. What I need is a way to configure both the accounts in same machine.

Problem Solution: So far I don't have any solution to this problem. But, I have found a work around to this problem. And here it is ...
  1. Assumptions: git-account-1, git-account-2
  2. Configure git-account-1 in your machine. Follow the git hub docs.
  3. Login to git-hub using git-account-1
  4. Search for git-account-2
  5. Click user name link
  6. Select the repository
  7. Click on Fork button


  8. By default git-account-1 will get read access to the repository
  9. Login to git-hub using git-account-2
  10. Open the repository link
  11. Click on Admin button
  12. Click Collaborators, Search user and Add