Lab 2a – Setup Git on your computer

By now you should have done the following:

  • Installed git on your computer
  • Sent your GitHub username to Michael and I to add you to the UCB-BACKEND-WEBARCH organization (if you don’t have a GitHub username, please create one here.
  • If you have not done the above, please do these steps now as part of this lab.

Another note on Git

Git is a source control system that enables you to keep track of the changes of the source files that you save in it. Think of it as a manual Dropbox, where you have to manually tell git to sync your files to your repository. In this class you will use your git repository to submit all of your assignments, and projects.

Please do the following

For the following instructions, please use Hyper or your terminal of choice to configure git for your application. What we want to do at the end of this lab is to

  1. Create your own repository for Assignment 1 on GitHub
  2. Clone the GitHub repository (i.e. copy the repository that is hosted on GitHub and link your local copy of the repository to GitHub’s copy.

Let’s get started:

  • Enter the below in your terminal:
    • git config --global user.email "[your email]"
    • git config --global user.name "[your github username]"
  • For example, when I’m setting up my environment I would enter the following:
    • git config --global user.email "kay@ischool.berkeley.edu"
    • git config --global user.name "kayashaolu"
  • And then lets take the time to set other time saving configurations:
    • git config --global core.editor pico
    • git config --global credential.helper "cache --timeout=3600"

The first line sets the editor that you’ll be editing git commits to pico, a much simpler terminal text editor than the default vim. The second line will save your credentials for a limited time so that you will not have to enter it over and over again.

  • Please check your email/piazza for the link to generate your own repository inside the GitHub Organization that you have joined earlier. Click on that link to create your assignment 1 repository.
  • Next lets clone this repository. You need to log into your GitHub account, navigate to the repository that , and then find the green “Clone and Download” button. Copy that url that it shows you.
  • Now you can run the command:
    • git clone [url]

Where [url] is the url that you copied from the GitHub web page. It may ask you for your username and password, and then it should download the repository!

Now that you have your repository set, you can now:

  • make changes to these files
  • git add [files] them to the staging location
  • git commit them to your repository
  • git push origin master those changes to your remote repository

For the homework assignment, I would like for you to create/edit a ABOUT.md file at the base of your repository. Please answer the following questions:

  • What is your goal for taking this class?
  • What would you like to learn in this class?

Be sure to push your changes to the remote repository. You’ll know that you’ve done it if you can see your changes on the GitHub page.

Once you push those files to your repository you are done! You can verify by going to GitHub.com and finding your repository and seeing if there is an ABOUT.md file with the content that you just entered.