Oct 1, 2014


    open a git account 

   get git and set your system up with git:
  •  install using apt-get:
  • get the requisites:
    sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
  • get git:
    wget https://git-core.googlecode.com/files/git-
  • unzip :
    tar -zxf git-
  • go into the directory for installation
    cd git- 
  •  install :
    make prefix=/usr/local all
    sudo make prefix=/usr/local install
  1. setup your github account into the git installed in your system
    git config --global user.name "alimurreza123"
    git config --global user.email alimurreza123@yahoo.com
  2. If everything works fine you will be able to see the already set user info using the following
    git config --list
    It should show:
  3. Reference

     Create a sample project to push into the repository:
  • create a workspace in your machine and get into the base directory of the project named 'testing':
    • mkdir -p ~/git/testing 
      cd ~/git/testing
  • copy few files and directory there. In real situation you will have your project directories such data, output, src etc.
  • converting the existing project into workspace environment
    • git init
      It should show the following message:
      Initialized empty Git repository in /home/user/git/testing/.git/
  • add everything inside the 'testing' project
    • git add .
  • Push the files using commit
    • git commit -m "Initial Commit" -a
      It says you have committed all the files/folders (-a option) and your message is "Initial commint" (-m) option
      Alternately you can add files folders explicitly using by their names 
  • If you want to push it into some remote server you need to push the project using 'push' from git.
    • git remote add origin ssh://git@github.com:alimurreza123/testing.git 
  •  Now push the project 'testing' into github repository
    • git push origin master
      It should show the something similar like this: 
      Counting objects: 6, done.
      Delta compression using up to 8 threads.
      Compressing objects: 100% (6/6), done.
      Writing objects: 100% (6/6), 2.06 KiB, done.
      Total 6 (delta 0), reused 0 (delta 0)
      To git@github.com:alimurreza123/testing.git
       * [new branch]      master -> master 
  • "git push tells git that we want to push our changes, "origin" is the name of our newly-configured remote server and "master" is the name of the first branch."     
  • You may need to setup you ssh-key before you can do this. Following talks about it.
  • Reference:
    Add the ssh-key if you want to push your code into the repository
    using ssh:
  • generate the public-private key pair
  • Add the public key in your github settings
  • select the paraphrase wisely. You will be prompted to enter the paraphrase when you want to push files into remote repository such as github.

Other reference:


No comments: