inside the mind of a linux admin

How to “Git” your own repository


Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. This guide will walk you through the basics of getting up and running with git.

First, you’ll need to install the client. If you’re using Ubuntu, you’ll want apt-get. Obviously RHEL based systems, use yum. If you do not have either, you’re hopefully smart enough to install git from source.

# apt-get install git
or
# yum -y install git

Great. Assuming that went successfully, you should now be able to run “git” and see the usage output.

Creating new repositories:

# mkdir myrepo
# cd myrepo
# git –bare init

Initialize and Commit

If you have an existing project in a folder, you can commit this as an initial import into your new repository. To do this, cd into the folder in question and do the following:

# git init
# git add .
# git commit -a -m ‘my first push’
# git remote add origin git@your.server.name:myrepo
# git push origin master

Creating an SSH key

You’ll want to create an SSH key to allow you to quickly pull and push to your remote repository.

# ssh-keygen -t dsa
# scp .ssh/id_dsa.pub git@your.server.name:
# ssh git@your.server.name
# cat id_dsa.pub >> .ssh/authorized_keys
# chmod 644 .ssh/authorized_keys

Related Posts

synergy: How to enable crypto (encryption) and generate SSL certificate

The newer Linux versions of the popular mouse/keyboard sharing application “synergy” now has built in encryption. Here’s how to configure it: Just simply passing the –enable-crypto flag on your synergy server without having a proper SSL certificate will result in the inability to connect to clients and generate an error message similar to this in […]

Read More

Change Number Pad Delete (dot) key from a comma in Ubuntu Linux

I recently purchased a new keyboard and updated to the latest Ubuntu, I’m also an avid user of the number pad for quick input when dealing with spreadsheets or accounting. I found that my num pad’s delete key (“.”) was outputting a comma (“,”) instead. Pretty annoying? I agree, but this can be very easily […]

Read More

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tweeter button Facebook button Myspace button