Skip to content
jzalinger edited this page Jan 30, 2012 · 7 revisions

Git is an extremely useful tool for keeping track of changes to code over time, especially when you have many people working on one code base. In order to get the Northern Bites' code, you first need to get git. See this page for info about setting up. NBites-specific instructions follow.

1. Make sure git is installed.

See Linux Setup.

2. Create a GitHub account.

Go to GitHub and create an account (it's free!). If you're here, you probably already did this, seeing as this wiki is part of GitHub. Your username should be the same as your Bowdoin username, for simplicity's sake.

3. Add your ssh-key.

There are very clear instructions here; see Set Up SSH Keys. If this doesn't work, you should also add the private key, which they don't tell you in the guide.

4. Fork the code.

Our main repository is called nbites. You should create your own fork of this repository. Go to the project link and click 'Fork.' You'll wind up with a project in your repositories list that is connected to the main repository under the northern-bites account. You may also want to 'follow' the northern-bites account and the accounts of other members of the team.

5. Download the code.

Run, with your_username being your GitHub username:

$> git clone git@github.com:your_username/nbites.git

6. Add an nbites remote.

Run the following commands in your nbites folder:

$> git remote add nbites git@github.com:northern-bites/nbites.git
$> git remote update

This adds the main Northern Bites master as a remote that you can pull from. You won't have push access to this remote, though.

7. Initialize submodules. (Optional)

To use the 'remote' application in our source, you also need to initialize the git submodules. To do this, run the following commands:

$> cd nbites/ #cd to the root of the nbites repository
$> git submodule init
$> git submodule update

This will download the other sources needed for compilation.

8. Set your user options.

Set your name:

$> git config --global user.name "Robot C. Ball"

Set your email:

$> git config --global user.email "rball@bowdoin.edu"

Git will attach your information to your commits, so be sure your set this info, or you will confuse people as to who it doing what work.

If you are working on someone else's user name, or on a shared account, you will not want to set these globally. If you leave off the '--global' option, you can sent these values for each individual git repository, thus enabling multiple people to maintain separate repositories on the same computer. Keep in mind that we would like to maintain accountability for all code changes, less for blaming people when something goes wrong than for being able to find out who to talk to about a problem.

9. Make aliases. (Optional)

These will provide shorter names for common git commands. For example git branch would be git br if you run the following commands:

git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.st status

Feel free to make the aliases whatever makes the most sense to you.

10. Other useful tweaks (Optional)

If you prefer to use emacs instead of vi (the default editor), run:

$> git config --global core.editor "emacs -nw"

On Linux, this sets the editor to be emacs (on the command line). Remove the -nw to pop up a GUI.

Colorize git:

$> git config --global color.status auto

Git branch in the prompt

Go to the following website: http://blog.tinucleatus.com/?p=275 and add the line to your .bashrc to see the currently checked-out git branch in your command prompt:

In other words, run

$> nano ~/.bashrc

and paste the above lines into the file.

You should now be good to go! Using git is a learning process, so see our Learning Git for help.

Clone this wiki locally