MacOS - Git with Atom GUI Tutorial

  1. Install Command Line
  2. Setup Gitlab
  3. Cloning the Repository
  4. Opening Up An Existing Local Repository
  5. Staging, Committing, Pushing

Installing Git Command Line

  1. Mac comes pre-installed with Git so there is no installation. Open it by clicking on the Spotlight Search in the top right of the menu bar. Instructional Image
  2. Search for "Terminal" and open up the application. Instructional Image
  3. Enter in the following commands followed by the enter key substituting your username and email (use your CSE email if you are a CSE student and UW email if you are not) in order to let Git know who you are.
    git config --global user.name "YOUR_USERNAME"
    git config --global user.email "your_email_address@example.com"
    Instructional Image

Setting up GitLab to work with your computer.

  1. Navigate to https://gitlab.cs.washington.edu/users/sign_in where you will sign in to GitLab for the first time. Use your CSE ID if you are in the CSE major. Otherwise, use your UW NetID. Instructional Image
  2. After that, switch to Terminal where you will run this command to generate a unique key to identify your computer with your email address substituted. LEAVE THE FILE AND PASSPHRASE BLANK! (It will break things if you don't) Just hit enter for both. If it prompts you to overwrite the file, type "y" then hit enter.
    ssh-keygen -o -t rsa -b 4096 -C "your_email_address@example.com"
    Instructional Image
  3. Then, copy this unique key to our clipboard by running the following command.
    pbcopy < ~/.ssh/id_rsa.pub
    Instructional Image
  4. With the key copied, navigate to https://gitlab.cs.washington.edu/profile/keys. There you will paste your copied key into the textbox and hit "Add key". Instructional Image
  5. Confirm that you set the key up correctly by navigating to Terminal again and running:
    ssh -T git@gitlab.cs.washington.edu
    Respond with "yes" to adding GitLab as a known host. You should see a nice welcome message in response. Instructional Image

Cloning the Repository

Install Atom if you have not already from here: https://atom.io/

Instructional Image
  1. After opening Atom, open up the "Command Palette" by using the menu bar or hitting "Cmd+Shift+P". Instructional Image
  2. Type in "Clone" and select "Github: Clone". Instructional Image
  3. Copy the "Clone with SSH" URL from the GitLab repository you would like to clone. Instructional Image
  4. Paste in the URL to clone first then modify the location to a folder that exists and that you will be able to access easily later. Then hit the "Clone" button (It may take a couple of seconds to complete). Instructional Image
  5. Your repository should now show up in the Project Viewer on the left side. Instructional Image

Opening Up An Existing Local Repository

  1. With Atom Open, select "File > Add Project Folder" from the menu bar or press "Cmd+Shift+O" or "Ctrl+Shift+O". Instructional Image
  2. Navigate to the existing repository folder, select it, and press "Open". MAKE SURE THAT IT IS THE MAIN DIRECTORY OF THE REPOSITORY! I does not work if it is a single file or any other directory, even if the repository is somewhere inside of it. Instructional Image
  3. Your repository should now show up in the Project Viewer on the left side. Instructional Image

Staging, Committing, Pushing

  1. Open up the Git GUI by clicking on the "Git" button in the bottom right. Instructional Image
  2. That will open up a Git View showing the "Unstaged" changed, the changes selected to be "Staged", and previous commits. Unstaged changes are any files that have been changed or new files added to the directory. By hitting "Stage All", you select all of the changed to be committed to the online repository. You can also select individual changes to stage. Instructional Image
  3. You should hit the "Fetch" button first down at the bottom to pull any existing changes from the online repository that might not be on your local one. Instructional Image
  4. Once you have staged the changes you want to commit, you can type in a descriptive commit message and hit "Commit to master". Instructional Image
  5. Finally, you need to hit "Push" to send your local commit to the online repository. Instructional Image