Getting Started with Github

  1. Use cd to navigate in the terminal to your project folder
  2. Clone your git repository using
    git clone URL
  3. Use cd to navigate in the terminal to your cloned git repository
  4. Create a Hello.java file in your git repository with the code for the Hello class:
    
    public class Hello {
      public static void main (String[] args) {
        System.out.println("Hello world");
      }
    }
    
  5. You will use javac to compile your Java files in the terminal and java to run them. Example:
    javac Hello.java

    java Hello
  6. If you have not done so, setup the git config with your email and name:
    git config --global user.email "yourusername@s.sfusd.edu"

    git config --global user.name "Your Name"
  7. Use git in the terminal to stage, commit, and push your files to GitHub.
    Check your changed files using the git status command
    git status

    Stage your uncommited files (this is for adding all uncommited files):
    git add --all

    Commit your staged files:
    git commit -m "add Hello program"

    Push your changes to GitHub.
    git push
  8. You can check if you have done this correctly by checking to see if your program files appear on GitHub.

    Posted in apcsa