Skip to content
minoriwww edited this page Aug 22, 2016 · 3 revisions

Introduction to Git

Introduction to Git by Scott Chacon: http://www.youtube.com/watch?v=7N6VBtkCHSQ

Eclipse

The CloudSimEx code is on Github. To use the project properly, you need the following:

  • Install Eclipse J2EE (Or any version with Eclipse Marketplace): http://www.eclipse.org/downloads/
  • Install Maven from Eclipse Marketplace: Eclipse > Help > Eclipse Marketplace > Search: Maven > Install: Maven Integration for Eclipse
  • Install EGit from Eclipse Marketplace: Eclipse > Help > Eclipse Marketplace > Search: EGit > Install: EGit - Git Team Provider
  • Add git connector to Maven: Eclipse > Window > Preferences > Maven > Discovery > Open Catalog > Check: m2e-egit > Finish
  • Locate the git URL. You have two options (choose one):
    1. Fork to a new repository: (It will be under your GitHub account. You can make it private or public repository. You can send a pull request later to mirage it with the main Clouds-Lab repository)
      • Go to: https://github.com/Cloudslab/CloudSimEx and fork the repository.
      • Go to your forked repository then locate the Clone button that will show you the git clone command, locate the URL, it should be something like: https://github.com/GITHUB_USERNAME/REPO_NAME.git
    2. Work on the main repository:
      • Clone the main repository: https://github.com/Cloudslab/CloudSimEx.git
      • You will need to ask for write permissions of the repository
  • Now you can checkout the source code as follows:
    • In Eclipse choose Import -> Maven -> Check out Maven projects from SCM
    • For SCM URL choose GIT and paste the url: git@github.com:GUTHUB_USERNAME/REPO_NAME.git

GUI

GitHub developed the best GUI applications for Git. It doesn't just work for GitHub, but almost for any Git repository. However, you must have a GitHub account in addition to the GitHub one to use their application.

Mac OS X

Confirmed to work on: Mac OS 10.8 (Mountain Lion).

  • Install Git for Mac: http://git-scm.com/downloads
  • Open Terminal (After running ssh-keygen leave everything empty, just press enter three times):

    ssh-keygen
    cat ~/.ssh/id_rsa.pub | pbcopy

Now you have generated public and private SSH keys in ~/.ssh/ and copied the public key into your clipboard.

  • Go to: http://github.org/ > Manage Account (click on your picture) > Account Settings > SSH Keys > Add SSH key.
    • Title: "Default Mac Public Key (nopass)".
    • Key: Just past ( + v) what you have in your clipboard (which is what's in ~/.ssh/id_rsa.pub).
  • Locate the git clone command. You have two options (choose one):
    1. Fork to a new repository: (It will be under your GitHub account. You can make it private or public repository. You can send a pull request later to mirage it with the main Clouds-Lab repository)
      • Go to: https://github.com/Cloudslab/cloudsimex and fork the repository.
      • Go to your forked repository then locate the Clone button that will show you the SSH clone command, it should be something like: git clone git@github.com:GITHUB_USERNAME/REPO_NAME.git
    2. Work on the main repository: (It will be under Clouds-Lab account. It has to be a public repository)
      • You will use this command: git clone git@github.com:cloudslab/cloudsimex.git
  • Open Terminal (use your own git clone command instead of git clone git@github.com:GITHUB_USERNAME/REPO_NAME.git ):

    mkdir ~/CloudSimEx
    cd ~/CloudSimEx
    git clone git@github.com:GITHUB_USERNAME/REPO_NAME.git

  • Create an account with GitHub: https://github.com/
  • Install GitHub for Mac: http://mac.github.com/
  • Open GitHub application and login using your GitHub account.
  • Drag the repository folder (~/CloudSimEx/cloudsimex in my case) into GitHub application

Once you have changed something in your local repository folder, just go to GitHub application > select your repository > Changes > Commit > Sync Branch.

Windows

Confirmed to work on: Windows 7.

  • Install Git for Windows: http://git-scm.com/downloads
  • Open Git Bash (After running ssh-keygen leave everything empty, just press enter three times):

    ssh-keygen
    cat ~/.ssh/id_rsa.pub | clip

Now you have generated public and private SSH keys in ~/.ssh/ and copied the public key into your clipboard.

  • Go to: http://github.com/ > Account Settings (click on your picture) > SSH Keys > Add SSH key.
    • Title: "Default Windows Public Key (nopass)".
    • Key: Just past (⊞ Win + v) what you have in your clipboard (which is what's in ~/.ssh/id_rsa.pub).
  • Locate the git clone command. You have two options (choose one):
    1. Fork to a new repository: (It will be under your GitHub account. You can make it private or public repository. You can send a pull request later to mirage it with the main Clouds-Lab repository)
      • Go to: https://github.org/Cloudslab/cloudsimex and fork the repository.
      • Go to your forked repository then locate the Clone button that will show you the SSH clone command, it should be something like: git clone git@github.com:GITHUB_USERNAME/REPO_NAME.git
    2. Work on the main repository: (It will be under Clouds-Lab account. It has to be a public repository)
      • You will use this command: git clone git@github.com:cloudslab/cloudsimex.git
  • Open Git Bash (use your own git clone command instead of git clone git@github.com:GITHUB_USERNAME/REPO_NAME.git ):

    mkdir ~/CloudSimEx
    cd ~/CloudSimEx
    git clone git@github.org:GITHUB_USERNAME/REPO_NAME.git

  • Create an account with GitHub: https://github.com/
  • Install GitHub for Windows: http://windows.github.com/
  • Open GitHub application and login using your GitHub account.
  • Drag the repository folder (~/CloudSimEx/cloudsimex in my case) into GitHub application

Once you have changed something in your local repository folder, just go to GitHub application > select your repository > Commit > Sync.

CLI


    git config --global user.name "Your Name Here"
    git config --global user.email "your_email@youremail.com"

Or watch this video:

Linux

On the different distributions of Linux the opportunities for using GIT under GUI are not that much. A simple, yet sufficient client is Git Cola. Another GUI application is RabbitVCS which as of today is still not that stable and may not work on some distributions.

Clone this wiki locally