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.
Tweet# 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
Erik
Friday, July 8, 2011
linux administration - tips, notes and projects
No Comment