Showing posts with label Git. Show all posts
Showing posts with label Git. Show all posts

Wednesday, November 14, 2012

Git commands

git add . : stages new and modified, without deleted
git add -u : stages modified and deleted, without new
git add -A : stages All

Thursday, March 1, 2012

Install Gitosis on CentOS how-to

Source1: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
Source2: http://wiki.centos.org/HowTos/Network/SecuringSSH

[On server side, login as root]
1. Install gitosis
   cd ~/src
   git clone git://eagain.net/gitosis.git
   cd gitosis
   yum install python-setuptools
   python setup.py install
2. Create a user who will own the repositories you want to manage. Usually called "git".
   useradd git
3. Copy your public key to the server (howard's $HOME/.ssh/ on server)
   [On local machine]
   scp ~/.ssh/id_rsa.pub howard@10.0.0.10:~/.ssh/
      [Create one if you don't have it, on local machine]
      ssh-keygen -t rsa
      . Both public and private key will be stored in ~/.ssh/, name id_rsa.pub and id_rsa
      . Change the permission as following:
         . chmod 700 ~/.ssh
         . chmod 600 ~/.ssh/id_rsa
4. Install public key to the authorized_keys list in order to log on with public/private key instead of password prompt
   [On local machine]
   ssh howard@10.0.0.10 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
   ssh howard@10.0.0.10 chmod 700 ~/.ssh
   ssh howard@10.0.0.10 chmod 600 ~/.ssh/authorized_keys
   . Now you will be log on to 10.0.0.10 without entering password
5. Init gitosis-admin repository
   . Copy howard's public key to tmp folder in case user "git"cannot access it in howard's $HOME/.ssh
   cp /home/howard/.ssh/id_rsa.pub /tmp
   . Now to init gitosis-admin repository
   sudo -H -u git gitosis-init < /tmp/id_rsa.pub
   chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
6. Change user "git"'s home directory to /home/git/repositories
7. Clone the gitosis-admin repository into your local machine
   [On local machine]
   . Find a place where you would like to create gitosis-admin repository
   git clone ssh://git@10.0.0.10:~/gitosis-admin.git
8. Now you have gitosis.conf file and keydir directory under gitosis-admin repository
   . With these 2 files, you can define access right for every user and all is done locally and push the changes to the server.

Creating new repositories [On local machine]
1. To allow howard creates/writes "ViewerRepo" repository, edit gitosis.conf and add following
   [group team1]
   members = howard
   writable = ViewerRepo
2. Save it and push to remote server
   git commit -a -m "Allow howard write access to ViewerRepo"
   git push
3. Now howard has access to create/write the ViewerRepo. But it's not created yet. let's create it now.
   mkdir ViewerRepo
   cd ViewerRepo
   git init
   git remote add origin git@10.0.0.10:~/ViewerRepo
   // git add and commit files
   git push origin master:refs/heads/master
4. Adding user aaron
   . Simply copy aaron' public keys to gitosis-admin/keydir/, when done, add to git
   git add keydir/aaron.pub
   . Edit gitosis.conf accordingly
   Change "members = howard" to "members = howard aaron"
   . Update the settings to remote server
   git commit -a -m "Granted aaron commit rights to ViewerRepo"
   git push
5. Now aaron can clone the ViewerRepo and working on it
   git clone git@10.0.0.10:~/ViewerRepo

Wednesday, February 29, 2012

Install Git on CentOS

Source1: http://www.davegardner.me.uk/blog/2010/01/29/setting-up-git-on-centos-5-server/
Source2: http://stackoverflow.com/questions/8059743/trying-to-install-git-on-centos-5-and-a-little-lost

Installing Git on CentOS 5 is easy if you make use of the EPEL (Extra Packages for Enterprise Linux) repository.
1. To setup EPEL all you need to do is create a file /etc/yum.repos.d/epel.repo and then paste in the following:
[epel]
name=Extra Packages for Enterprise Linux 5 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL

[epel-debuginfo]
name=Extra Packages for Enterprise Linux 5 - $basearch - Debug
#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch/debug
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-debug-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux 5 - $basearch - Source
#baseurl=http://download.fedoraproject.org/pub/epel/5/SRPMS
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-source-5&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
gpgcheck=1
2. Install GPG Keys


Go into rpm-gpg directory
cd /etc/pki/rpm-gpg/
Download GPG KEYS from https://fedoraproject.org/keys
wget https://fedoraproject.org/static/217521F6.txt
Rename to "217521F6.txt" to "RPM-GPG-KEY-EPEL"
cp 217521F6.txt RPM-GPG-KEY-EPEL
Remove "217521F6.txt" because we don't need in that file anymore
rm 217521F6.txt
If you want you can remove prefix lines from the file by vim and :wq (:Write and Quit)
vim RPM-GPG-KEY-EPEL
3. Installing git git-daemon
yum install git git-daemon

Check clients which connect to Mac OS X Wi-Fi Internet Sharing

arp -i bridge100 -a bridge100 may be different on your Mac OSX