-
Notifications
You must be signed in to change notification settings - Fork 0
Configuring Git
Git is a version-control and software-management system. It 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.
$> sudo apt-get install git-core git-gui git-doc
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.
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.
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.
Navigate to where you want our code to live on your machine. We recommend your home directory. Open a terminal and use the command:
$> cd ~
Then run the following, with your_username being your GitHub username:
$> git clone [email protected]:your_username/nbites.git
Now cd
into nbites
and run the following commands:
$> git remote add northern-bites 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. If you're a member of the team who needs push access and are on the push list on github, use this url instead of the one above:
[email protected]:northern-bites/nbites.git
Set your name:
$> git config --global user.name "Robot C. Ball"
Set your email:
$> git config --global user.email "[email protected]"
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.
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.
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.
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
On mac OS X, to be able to tab complete names of branches, remotes, and other names in git, download this file and rename it (use the 'mv' command in the terminal) to ~/.git-completion.sh Then, add this line to your .bash_rc, .profile, .bash_profile, or equivalent:
source .git-completion.sh
Check out this gist. This will colorize your prompt and put the current git branch in the prompt if you're in a git repository. See this if you're interested in changing the colors.
You should now be good to go! Using git is a learning process, so see our Learning Git for help.
Head back to Linux Setup once you're done!