IMPORTANT: We will step through this together in class. You do not need to do this on your own.
- Log into your GitHub account, and "star" the DAT_SF_19 repository (the one you are looking at right now) by clicking the Star button in the upper right corner of the screen.
- You should already have git installed.
- Make sure you have Sublime Text 2 installed.
- Open a command line application:
- For Windows, we recommend Git Bash instead of Git Shell (which uses Powershell).
- For Mac, you will probably be using Terminal, or another command line tool of your choice.
-
Configure your global git user name and email settings:
-
Type
git config --listto see your current git configuration settings. What is theuser.namesetting? What is theuser.emailsetting? Next, we will configure git to use your github user name and email address. -
Type
git config --global user.name "YourFirstName YourLastName"(including the quotes) -
Type
git config --global user.email "youremail@domain.com"(use the email address associated with your GitHub account) -
Type
git config --listagain. Those setting should be updated to match the config changes you just made. Note that you can also check an specific setting by typinggit config --globalwith no argument. -
Fork the course repo to your Github user account:
-
In your browser, go to the course repo at
https://github.com/hallr/DAT_SF_19 -
Click on the "Fork" button on that page.
-
After a few seconds, you should see a fork of the repo under YOUR github account.
-
Clone YOUR FORK of the course repo to your laptop:
-
cd to the place where you want to copy the course repo. Your desktop is a great place for this while in the course, but any place where you can easily find it via the command line is fine. Create a "General Assembly" directory.
-
cd into the General Assembly directory. The following will create a folder called "DAT_SF_19" in that directory of your computer, and will copy the repository into that folder.
-
Clone the course repo to your laptop by typing
git cloneand the HTTPS URL for your forked repo. It will be of the formhttps://github.com/<yourGithubUsername>/DAT_SF_19.git -
cd into the DAT_SF_19 directory that is now on your laptop. List the contents of that directory. What do you see?
-
IMPORTANT: Always copy and rename files before modifying them in your fork of the course repo. If you modify a course file, then git will detect a merge conflict the next time you pull from the updated course repo. These are no fun.
-
Create a folder called "Homework" in your repo. This is the folder in which you will do your work and submit homework assignments.
-
Setup remotes:
-
Set up your fork to pull the latest content from the instructor repo in Rob's github account. To do this, we'll create what's called an upstream remote. Type
git remote add instructor https://github.com/hallr/DAT_SF_19.git -
Type
git remote -vto confirm your remotes are set up correctly. -
From now on, to get the latest content from the course repo, type
git pull instructor -
OS X / Unix ONLY Install the
sublcommand: In this step, we will install a new command that will enable us to launch Sublime Text 2 from the command line. We will also set Sublime Text 2 as the default editor for git. The default text editor for git is the system default. So, unless you are comfortable working in vi (on OS X), we strongly recommend that you set up git to use Sublime Text 2. -
STOP. We will do this together! Copy/paste the following to your command line. This creates a symlink. Make sure it copies exactly and that you have not missed any characters!
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
-
Enter the password for your computer when prompted.
-
Type
subl README.md. Sublime should launch a new window with the markdown for the course schedule (remember you should be in the course repo). If this displays as expected, simply close Sublime Text. -
OS X / Unix ONLY Make Sublime Text 2 your default text editor for git:
-
Type
git config --global core.editor "subl -n -w" -
To test this config setting, type
git config -eto launch the default text editor for git. Again, Sublime Text should display. Close Sublime Text. -
Finally, let's get some practice with our new workflow!
-
Create a new text file in your Homework folder. Call it
temp.txtor something similar. It can be an empty text file. -
Type
git status. What do you see? -
Type 'git add` and your file name.
-
Type
git statusagain. What changed? -
Type
git commit -m "initial commit". Hit enter. -
Switch back to your browser to view your work repo on Github and refresh the page. Do you see any files other than the README.md?
-
Switch back to the command line and type
git push -u origin master. What happens? -
Switch back to Github and refresh the page for your repo. What do you see now?
-
Bonus question: What do you think will happen if you type
git push -u instructor master? Why?