no

Introduction to Git and Code Versioning

Go Back to Course Outline I. What is Github? Github is a global company currently owned by Microsoft. Its core feature is an online ...

Go Back to Course Outline

I. What is Github?

Github is a global company currently owned by Microsoft. Its core feature is an online code git repository service. Through the years many more features were added such as wiki, task management, and collaboration tool for every project. Github also created its own marketplace where you can upload and sell your own plugin that integrates with Github. See this link https://github.com/marketplace.

Nowadays, there are several GUI based clients that we can use to interact with git such as Tortoise GIT which we will install later.

II. Git Installation

  1. Download and install Git from https://git-scm.com/downloads.
  2. Check if it is properly installed by opening the command prompt and entering the command > git version.

III. Git Client Installation

  1. Install a Git client, I’m using Tortoise which is available for download at https://tortoisegit.org/download.

IV. Generate SSH Key

  1. Open your command prompt.
  2. Execute: ssh-keygen -t rsa -C "" and answer the succeeding questions. Make sure to remember and write down your password.
  3. Copy the generated files (id_rsa, id_rsa.pub) to your user's .ssh folder. For example in windows it's in c:\users\me\.ssh.

V. Create a Github Account

  1. Open your browser and navigate at https://github.com.
  2. Click the Signup button in the top-right corner.
  3. And enter your registration details with a valid email address.
  4. It should send a validation email to the email you use in registration and after clicking it, you should be able to log in and use Github.
  5. Login to Github and click the arrow down icon in the top-right corner. Then click Settings.
  6. On the right side, under the “Personal Settings” panel, click SSH and GPG keys.
  7. Copy the content of id_rsa.pub that we have created in the previous slide.
  8. In the SSH Keys screen, click New SSH Key.
  9. Fill in the Title and paste the id_rsa.pub content in the Key field.
  10. Your new key should be listed in the SSH Keys screen.
  11. Next, we will create our very first Github project.

VI. Creating our very first Github Project

  1. Login to your Github account.
  2. Create a new repository by either:
    1. Clicking the New button in the left panel with Repository title or;
    2. Clicking the plus icon in the top-right corner and select New Repository.
  3. Fill in the following details
    1. Repository name
    2. Description
    3. Public - means our project is accessible to anyone
  4. Don’t tick the Initialize this repository with a README.
  5. Click Create repository.
  6. In the repository detail copy the URL under the green “Clone or download” button. Should be in this format: git@github.com:czetsuya/hello-world2.git

VII. Pushing our hello-world2 Project

  1. Fire-up eclipse with the hello-world2 project that we have created in the previous video.
  2. Right-click on the hello-world2 project, select Team and then Share Project.
  3. You should arrive in the Share Project panel. 
    1. Click “Use or create repository in parent folder of project".
    2. In the project list, select hello-world2.
    3. At the left-bottom part, click Create repository.
  4. Again right-click on the hello-world2 project, select Team then Commit.
  5. A new View “Git Staging” should open. 
    1. Right-click the .gitignore file and click ignore if present.
    2. Drag the files from Unstaged Changes panel to Staged Changes.
    3. Add a commit message.
    4. Click “Commit”.
  6. Open, Git Repositories. In eclipse click Window / Show View / Other, in the filter enter git and select Git Repositories.
  7. In the Git Repositories view, you should be able to see the hello-world2 project.
    1. Right-click on the hello-world2 project, and select “Push Branch ‘master’”.
    2. A new panel “Destination Git Repository” should appear.
    3. In the Location / URI field paste the repository URL that we copied earlier when we created the repository in Github.
  8. Hit the Preview button and then Preview again. A Push Confirmation screen should show up with the details. In this case, we are pushing the master branch.
  9. Finally hit the Push-button.
  10. Congratulations! You just created your first Github project.

VIII. How does Github work?

  1. Modify the App.java. Add a new println line.
  2. Commit and push the changes to a remote repository.
  3. Check the github project online.
  4. Create and checkout a new branch integration.
  5. Modify App.java and commit.
  6. Merge the integration branch to master.

Related

java-getting-started 387144524587241347

Post a Comment Default Comments

item