SlideShare a Scribd company logo
1 of 30
Download to read offline
#4




          Git Workshop
            Git on the Server

              Wildan Maulana
       wildan.m@openthinklabs.com


     http://workshop.openthinklabs.com
Refresh Your Mind : http://blogs.mikeci.com/2010/09/17/getting-started-subversion-git/
The Protocols
●   Git can use four major network protocols to
    transfer data
    ●   Local
    ●   Secure Shell (SSH)
    ●   Git
    ●   HTTP
Local Protocol
$ git clone /opt/git/project.git


                          How to Clone a local repository....
                 Or ...


$ git clone file:///opt/git/project.git


               $ git remote add local_proj /opt/git/project.git



                          How to add a local repository to an existing Git project
Local Protocol



● Simple                          ● Shared access is generally more difficult
● Use existing file permissions
                                  to set up and reach from multiple
● Network access
                                  locations than basic network access
● …..
The SSH Protocol
$ git clone ssh://user@server:project.git


                                 How to clone a Git repository over SSH

$ git clone user@server:project.git



       Not specify a user, and Git assumes the user you’re currently logged in as.
The SSH Protocol



● You basically have to use it if
you want authenticated
                                      ●   You can’t serve anonymous
write access to your                      access of your repository over it
repository over a network
● SSH is relatively easy to set up

● Access over SSH is secure

● Like the Git and Local protocols,

SSH is efficient, making the data
as compact as possible
before transferring it.
The Git Protocol
●   This is a special daemon that comes packaged with Git; it
    listens on a dedicated port (9418) that provides a service
    similar to the SSH protocol, but with absolutely no
    authentication.
●   In order for a repository to be served over the Git
    protocol, you must create the git-export-daemon-ok
    file — the daemon won’t serve a repository without that
    file in it — but other than that there is no security.
●   Pull only, if you enable Push anyone on the internet who
    finds your project’s URL could push to your project
The Git Protocol



● The Git protocol is the fastest   ● The downside of the Git protocol is
transfer protocol available         the lack of authentication
                                    ● It’s also probably the most

                                      difficult protocol to set up
The HTTP/S Protocol
$   cd /var/www/htdocs/
$   git clone --bare /path/to/git_project gitproject.git
$   cd gitproject.git
$   mv hooks/post-update.sample hooks/post-update
$   chmod a+x hooks/post-update



$ git clone http://example.com/gitproject.git
The Git Protocol



● It’s easy to set up                       ● It’s relatively inefficient for the client
● The HTTP protocol also isn’t

very resource intensive on your server
● You can also serve your repositories

read-only over HTTPS;
or you can go so far as
to make the clients use specific
signed SSL certificates
● HTTP is such a commonly used protocol that

corporate firewalls are often set up to allow traffic through this port
Git push over HTTP




   http://bit.ly/iA4T20
Getting Git on a Server
$ git clone --bare my_project my_project.git
Initialized empty Git repository in /opt/projects/my_project.git/



                     Clone your repository to create a new bare repository,


   Roughly equivalent to something like


  $ cp -Rf my_project/.git my_project.git
Putting the Bare Repository on a Server
$ scp -r my_project.git user@git.example.com:/opt/git



$ git clone user@git.example.com:/opt/git/my_project.git


If a user SSHs into a server and has write access to the
/opt/git/my_project.git directory, they will also automatically have push access.


 Git will automatically add group write permissions to a repository properly
if you run the git init command with the --shared option.

                                   $ ssh user@git.example.com
                                   $ cd /opt/git/my_project.git
                                   $ git init --bare --shared
Small Setups
 One of the most complicated aspects of setting up a Git server is user management.
 If you want some repositories to be read-only to certain users
 and read/write to others, access and permissions can be a bit difficult to arrange.

Have your SSH server authenticate from an LDAP server
or some other centralized authentication source

                                  SSH Access

Set up accounts for everybody,
which is straightforward but can be cumbersome

                            Create a single ‘git’ user on the machine,
                            ask every user who is to have write access
                            to send you an SSH public key, and
                            add that key to the ~/.ssh/authorized_keys
                            file of your new ‘git’ user.
Generating Your SSH Public Key
$ cd ~/.ssh
$ ls
authorized_keys2      id_dsa          known_hosts
config                id_dsa.pub

$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/schacon/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/schacon/.ssh/id_rsa.
Your public key has been saved in /Users/schacon/.ssh/id_rsa.pub.
The key fingerprint is:
43:c5:5b:5f:b1:f1:50:43:ad:20:a6:92:6a:1f:9a:3a schacon@agadorlaptop.local
Generating Your SSH Public Key

$ cat ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3
Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA
t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En
mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx
NrRFi9wrf+M7Q== schacon@agadorlaptop.local


 Now, each user that does this has to send their public key to you
 or whoever is administrating the Git server
 (assuming you’re using an SSH server setup that requires public keys).
 All they have to do is copy the contents of the .pub file and e-mail it

         More Info : http://github.com/guides/providing-your-ssh-key
Setting Up the Server
$   sudo adduser git
$   su git
$   cd
$   mkdir .ssh
                               You just append them to your authorized_keys file:


        $ cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys
        $ cat /tmp/id_rsa.josie.pub >> ~/.ssh/authorized_keys
        $ cat /tmp/id_rsa.jessica.pub >> ~/.ssh/authorized_keys


       $   cd /opt/git
       $   mkdir project.git
       $   cd project.git
       $   git --bare init
Setting Up the Server
#   on Johns computer
$   cd myproject
$   git init
$   git add .
$   git commit -m 'initial commit'
$   git remote add origin git@gitserver:/opt/git/project.git
$   git push origin master

    At this point, the others can clone it down and push changes back up just as easily:

     $   git   clone git@gitserver:/opt/git/project.git
     $   vim   README
     $   git   commit -am 'fix for the README file'
     $   git   push origin master
Setting Up the Server
  As an extra precaution, you can easily restrict the ‘git’ user to only doing Git activities
  with a limited shell tool called git-shell that comes with Git. If you set this
  as your ‘git’ user’s login shell, then the ‘git’ user can’t have normal
  shell access to your server.

$ sudo vim /etc/passwd

At the bottom, you should find a line that looks something like this:

git:x:1000:1000::/home/git:/bin/sh


  git:x:1000:1000::/home/git:/usr/bin/git-shell

                $ ssh git@gitserver
                fatal: What do you think I am? A shell?
                Connection to gitserver closed.
Public Access
Enable the hook:

$ cd project.git
$ mv hooks/post-update.sample hooks/post-update
$ chmod a+x hooks/post-update

<VirtualHost *:80>
    ServerName git.gitserver
    DocumentRoot /opt/git        $ chgrp -R www-data /opt/git
    <Directory /opt/git/>
        Order allow, deny
        allow from all
    </Directory>
</VirtualHost>

                   $ git clone http://git.gitserver/project.git
GitWeb
$ git instaweb --httpd=webrick
[2009-02-21 10:02:21] INFO WEBrick 1.3.1
[2009-02-21 10:02:21] INFO ruby 1.8.6 (2008-03-03) [universal-darwin9.0]




               $ git instaweb --httpd=webrick --stop
GitWeb
               Installation from Source Code
     $ git clone git://git.kernel.org/pub/scm/git/git.git
     $ cd git/
     $ make GITWEB_PROJECTROOT="/opt/git" 
             prefix=/usr gitweb/gitweb.cgi
     $ sudo cp -Rf gitweb /var/www/

<VirtualHost *:80>
    ServerName gitserver
    DocumentRoot /var/www/gitweb
    <Directory /var/www/gitweb>
        Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch
        AllowOverride All
        order allow,deny
        Allow from all
        AddHandler cgi-script cgi
        DirectoryIndex gitweb.cgi
    </Directory>
</VirtualHost>
GitWeb
Binary (Ubuntu/RHEL)




Howto : http://bit.ly/OyTH8
Gitosis
                      On Ubuntu
 apt-get install python-setuptools

       $ git clone git://eagain.net/gitosis.git
       $ cd gitosis
       $ sudo python setup.py install

    $ ln -s /opt/git /home/git/repositories


$ mv /home/git/.ssh/authorized_keys /home/git/.ssh/ak.bak
Gitosis
git:x:1000:1000::/home/git:/usr/bin/git-shell


                          git:x:1000:1000::/home/git:/bin/sh




$ sudo -H -u git gitosis-init < /tmp/id_dsa.pub
Initialized empty Git repository in /opt/git/gitosis-admin.git/
Reinitialized existing Git repository in /opt/git/gitosis-admin.git/


       $ sudo chmod 755 /opt/git/gitosis-admin.git/hooks/post-update
Gitosis
$ ssh git@gitserver
PTY allocation request failed on channel 0
fatal: unrecognized command 'gitosis-serve schacon@quaternion'
  Connection to gitserver closed.


                # on your local computer
                $ git clone git@gitserver:gitosis-admin.git



        $ cd gitosis-admin                 $ cat gitosis.conf
        $ find .                           [gitosis]
        ./gitosis.conf
        ./keydir                           [group gitosis-admin]
        ./keydir/scott.pub                 writable = gitosis-admin
                                           members = scott
Gitosis
Create a new project called iphone_project to start on:
  [group mobile]
  writable = iphone_project
  members = scott

           Whenever you make changes to the gitosis-admin project,
           you have to commit the changes and push them back up to the server
           in order for them to take effect:
               $ git commit -am 'add iphone_project and mobile group'
               [master]: created 8962da8: "changed name"
                1 files changed, 4 insertions(+), 0 deletions(-)
               $ git push
               Counting objects: 5, done.
               Compressing objects: 100% (2/2), done.
               Writing objects: 100% (3/3), 272 bytes, done.
               Total 3 (delta 1), reused 0 (delta 0)
               To git@gitserver:/opt/git/gitosis-admin.git
                  fb27aec..8962da8 master -> master
Gitosis




More ….
Reference
●   ProGit, Scott Chacon, Apress
●   Just Enough Developed Infrastructure

More Related Content

What's hot

Карманный PaaS с Dokku (Александр Белецкий)
Карманный PaaS с Dokku (Александр Белецкий)Карманный PaaS с Dokku (Александр Белецкий)
Карманный PaaS с Dokku (Александр Белецкий)GeeksLab Odessa
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoLuis Bertel
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHubJames Gray
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitAmit Mathur
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
Advancing Bitcoin 2019 - BTCPayServer Architecture
Advancing Bitcoin 2019  - BTCPayServer ArchitectureAdvancing Bitcoin 2019  - BTCPayServer Architecture
Advancing Bitcoin 2019 - BTCPayServer ArchitectureAndrew Camilleri
 
Http2.0 Guide 2013-08-14 #http2study
Http2.0 Guide 2013-08-14 #http2studyHttp2.0 Guide 2013-08-14 #http2study
Http2.0 Guide 2013-08-14 #http2studyJxck Jxck
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control SystemMohammad Imam Hossain
 
RHEL/Fedora + Docker (and SELinux)
RHEL/Fedora + Docker (and SELinux)RHEL/Fedora + Docker (and SELinux)
RHEL/Fedora + Docker (and SELinux)Maciej Lasyk
 

What's hot (20)

Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git Basic
Git BasicGit Basic
Git Basic
 
Карманный PaaS с Dokku (Александр Белецкий)
Карманный PaaS с Dokku (Александр Белецкий)Карманный PaaS с Dokku (Александр Белецкий)
Карманный PaaS с Dokku (Александр Белецкий)
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Rc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocidoRc094 010d-git 2 - desconocido
Rc094 010d-git 2 - desconocido
 
Git Heaven with Wakanda
Git Heaven with WakandaGit Heaven with Wakanda
Git Heaven with Wakanda
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git
GitGit
Git
 
Git internals
Git internalsGit internals
Git internals
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Git & Github for beginners
Git & Github for beginnersGit & Github for beginners
Git & Github for beginners
 
Git
GitGit
Git
 
Advancing Bitcoin 2019 - BTCPayServer Architecture
Advancing Bitcoin 2019  - BTCPayServer ArchitectureAdvancing Bitcoin 2019  - BTCPayServer Architecture
Advancing Bitcoin 2019 - BTCPayServer Architecture
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
Http2.0 Guide 2013-08-14 #http2study
Http2.0 Guide 2013-08-14 #http2studyHttp2.0 Guide 2013-08-14 #http2study
Http2.0 Guide 2013-08-14 #http2study
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
RHEL/Fedora + Docker (and SELinux)
RHEL/Fedora + Docker (and SELinux)RHEL/Fedora + Docker (and SELinux)
RHEL/Fedora + Docker (and SELinux)
 

Viewers also liked

Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSMatthew McCullough
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareChris Jean
 
Don't sh** in the Pool
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the PoolChris Jean
 
Takeaways From Migrating to Git and Bitbucket Server
Takeaways From Migrating to Git and Bitbucket ServerTakeaways From Migrating to Git and Bitbucket Server
Takeaways From Migrating to Git and Bitbucket ServerAtlassian
 
Dna library lecture-Gene libraries and screening
Dna library lecture-Gene libraries and screening  Dna library lecture-Gene libraries and screening
Dna library lecture-Gene libraries and screening Abdullah Abobakr
 
Mock Servers - Fake All the Things!
Mock Servers - Fake All the Things!Mock Servers - Fake All the Things!
Mock Servers - Fake All the Things!Atlassian
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git RightSven Peters
 
Git Branching for Agile Teams
Git Branching for Agile TeamsGit Branching for Agile Teams
Git Branching for Agile TeamsSven Peters
 

Viewers also liked (10)

Blood Brochure (56 pages)
Blood Brochure (56 pages)Blood Brochure (56 pages)
Blood Brochure (56 pages)
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
 
Don't sh** in the Pool
Don't sh** in the PoolDon't sh** in the Pool
Don't sh** in the Pool
 
Takeaways From Migrating to Git and Bitbucket Server
Takeaways From Migrating to Git and Bitbucket ServerTakeaways From Migrating to Git and Bitbucket Server
Takeaways From Migrating to Git and Bitbucket Server
 
Dna library lecture-Gene libraries and screening
Dna library lecture-Gene libraries and screening  Dna library lecture-Gene libraries and screening
Dna library lecture-Gene libraries and screening
 
Mock Servers - Fake All the Things!
Mock Servers - Fake All the Things!Mock Servers - Fake All the Things!
Mock Servers - Fake All the Things!
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
Git Branching for Agile Teams
Git Branching for Agile TeamsGit Branching for Agile Teams
Git Branching for Agile Teams
 
Git Branching Model
Git Branching ModelGit Branching Model
Git Branching Model
 

Similar to Git Workshop : Git On The Server

Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in UnityRifauddin Tsalitsy
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceForest Mars
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucketazwildcat
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneVEXXHOST Private Cloud
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
Getting started with git
Getting started with gitGetting started with git
Getting started with gitPawan Kumar.v
 
LasCon 2014 DevOoops
LasCon 2014 DevOoops LasCon 2014 DevOoops
LasCon 2014 DevOoops Chris Gates
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxAbelPhilipJoseph
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysCarlos Taborda
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgitGeshan Manandhar
 
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015Chris Gates
 

Similar to Git Workshop : Git On The Server (20)

Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git & G
Git & GGit & G
Git & G
 
Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
GTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSourceGTFO: Git Theory For OpenSource
GTFO: Git Theory For OpenSource
 
git-and-bitbucket
git-and-bitbucketgit-and-bitbucket
git-and-bitbucket
 
Git setuplinux
Git setuplinuxGit setuplinux
Git setuplinux
 
GitSetupLinux
GitSetupLinuxGitSetupLinux
GitSetupLinux
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub Clone
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Git presentation
Git presentationGit presentation
Git presentation
 
Getting started with git
Getting started with gitGetting started with git
Getting started with git
 
LasCon 2014 DevOoops
LasCon 2014 DevOoops LasCon 2014 DevOoops
LasCon 2014 DevOoops
 
git github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptxgit github PPT_GDSCIIITK.pptx
git github PPT_GDSCIIITK.pptx
 
Git introduction
Git introductionGit introduction
Git introduction
 
Why Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anywaysWhy Git Sucks and you'll use it anyways
Why Git Sucks and you'll use it anyways
 
Git ongithub
Git ongithubGit ongithub
Git ongithub
 
Git intro hands on windows with msysgit
Git intro hands on windows with msysgitGit intro hands on windows with msysgit
Git intro hands on windows with msysgit
 
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
Devoops: DoJ Annual Cybersecurity Training Symposium Edition 2015
 

More from Wildan Maulana

Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018Wildan Maulana
 
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...Wildan Maulana
 
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam MelonKetahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam MelonWildan Maulana
 
Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014Wildan Maulana
 
ICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi ArsipICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi ArsipWildan Maulana
 
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RWOpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RWWildan Maulana
 
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...Wildan Maulana
 
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyToolsPostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyToolsWildan Maulana
 
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...Wildan Maulana
 
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai SpMensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai SpWildan Maulana
 
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity ProviderKonfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity ProviderWildan Maulana
 
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)Wildan Maulana
 
Instalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphpInstalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphpWildan Maulana
 
River Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River RestorationRiver Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River RestorationWildan Maulana
 
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...
Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...Wildan Maulana
 
Penilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan DasarPenilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan DasarWildan Maulana
 
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and UsesProyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and UsesWildan Maulana
 
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang TuaOpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang TuaWildan Maulana
 
Menggunakan AlisJK : Equating
Menggunakan AlisJK : EquatingMenggunakan AlisJK : Equating
Menggunakan AlisJK : EquatingWildan Maulana
 

More from Wildan Maulana (20)

Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018Hasil Pendataan Potensi Desa 2018
Hasil Pendataan Potensi Desa 2018
 
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
Double for Nothing? Experimental Evidence on an Unconditional TeacherSalary I...
 
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam MelonKetahanan Pangan #1 : Gerakan Sekolah Menanam Melon
Ketahanan Pangan #1 : Gerakan Sekolah Menanam Melon
 
Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014Pengembangan OpenThink SAS 2013-2014
Pengembangan OpenThink SAS 2013-2014
 
ICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi ArsipICA – AtoM : Retensi Arsip
ICA – AtoM : Retensi Arsip
 
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RWOpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
OpenThink Labs Workshop : Ketahanan Pangan Skala RT/RW
 
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
OpenThink Labs : Dengar Pendapat Komunitas ciliwung dengan kemen pu dan kemen...
 
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyToolsPostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
PostgreSQL BootCamp : Manajemen Master Data dengan SkyTools
 
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...Mensetup Google Apps sebagai IdP jenis openID  dan Aplikasi Berbasis CakePHP ...
Mensetup Google Apps sebagai IdP jenis openID dan Aplikasi Berbasis CakePHP ...
 
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai SpMensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
Mensetup Google Apps sebagai IdP jenis openID dan Wordpress sebagai Sp
 
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity ProviderKonfigurasi simpleSAMLphp  dengan Google Apps Sebagai Identity Provider
Konfigurasi simpleSAMLphp dengan Google Apps Sebagai Identity Provider
 
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
Instalasi simpleSAMLphp sebagai Identity Provider (IdP)
 
Instalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphpInstalasi dan Konfigurasi simpleSAMLphp
Instalasi dan Konfigurasi simpleSAMLphp
 
River Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River RestorationRiver Restoration in Asia and Connection Between IWRM and River Restoration
River Restoration in Asia and Connection Between IWRM and River Restoration
 
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...
Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...Optimasi Limpasan Air Limbah  Ke Kali Surabaya (Segmen Sepanjang – Jagir)  De...
Optimasi Limpasan Air Limbah Ke Kali Surabaya (Segmen Sepanjang – Jagir) De...
 
Penilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan DasarPenilaian Siswa di Finlandia - Pendidikan Dasar
Penilaian Siswa di Finlandia - Pendidikan Dasar
 
Statistik Listrik
Statistik ListrikStatistik Listrik
Statistik Listrik
 
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and UsesProyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
Proyek Al-'Alaq : Electric Bicycles ; History, Characteristics, and Uses
 
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang TuaOpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
OpenThink SAS : Interaksi Antara Sekolah, Wali Kelas, Siswa dan Orang Tua
 
Menggunakan AlisJK : Equating
Menggunakan AlisJK : EquatingMenggunakan AlisJK : Equating
Menggunakan AlisJK : Equating
 

Recently uploaded

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Git Workshop : Git On The Server

  • 1. #4 Git Workshop Git on the Server Wildan Maulana wildan.m@openthinklabs.com http://workshop.openthinklabs.com
  • 2. Refresh Your Mind : http://blogs.mikeci.com/2010/09/17/getting-started-subversion-git/
  • 3. The Protocols ● Git can use four major network protocols to transfer data ● Local ● Secure Shell (SSH) ● Git ● HTTP
  • 4. Local Protocol $ git clone /opt/git/project.git How to Clone a local repository.... Or ... $ git clone file:///opt/git/project.git $ git remote add local_proj /opt/git/project.git How to add a local repository to an existing Git project
  • 5. Local Protocol ● Simple ● Shared access is generally more difficult ● Use existing file permissions to set up and reach from multiple ● Network access locations than basic network access ● …..
  • 6. The SSH Protocol $ git clone ssh://user@server:project.git How to clone a Git repository over SSH $ git clone user@server:project.git Not specify a user, and Git assumes the user you’re currently logged in as.
  • 7. The SSH Protocol ● You basically have to use it if you want authenticated ● You can’t serve anonymous write access to your access of your repository over it repository over a network ● SSH is relatively easy to set up ● Access over SSH is secure ● Like the Git and Local protocols, SSH is efficient, making the data as compact as possible before transferring it.
  • 8. The Git Protocol ● This is a special daemon that comes packaged with Git; it listens on a dedicated port (9418) that provides a service similar to the SSH protocol, but with absolutely no authentication. ● In order for a repository to be served over the Git protocol, you must create the git-export-daemon-ok file — the daemon won’t serve a repository without that file in it — but other than that there is no security. ● Pull only, if you enable Push anyone on the internet who finds your project’s URL could push to your project
  • 9. The Git Protocol ● The Git protocol is the fastest ● The downside of the Git protocol is transfer protocol available the lack of authentication ● It’s also probably the most difficult protocol to set up
  • 10. The HTTP/S Protocol $ cd /var/www/htdocs/ $ git clone --bare /path/to/git_project gitproject.git $ cd gitproject.git $ mv hooks/post-update.sample hooks/post-update $ chmod a+x hooks/post-update $ git clone http://example.com/gitproject.git
  • 11. The Git Protocol ● It’s easy to set up ● It’s relatively inefficient for the client ● The HTTP protocol also isn’t very resource intensive on your server ● You can also serve your repositories read-only over HTTPS; or you can go so far as to make the clients use specific signed SSL certificates ● HTTP is such a commonly used protocol that corporate firewalls are often set up to allow traffic through this port
  • 12. Git push over HTTP http://bit.ly/iA4T20
  • 13. Getting Git on a Server $ git clone --bare my_project my_project.git Initialized empty Git repository in /opt/projects/my_project.git/ Clone your repository to create a new bare repository, Roughly equivalent to something like $ cp -Rf my_project/.git my_project.git
  • 14. Putting the Bare Repository on a Server $ scp -r my_project.git user@git.example.com:/opt/git $ git clone user@git.example.com:/opt/git/my_project.git If a user SSHs into a server and has write access to the /opt/git/my_project.git directory, they will also automatically have push access. Git will automatically add group write permissions to a repository properly if you run the git init command with the --shared option. $ ssh user@git.example.com $ cd /opt/git/my_project.git $ git init --bare --shared
  • 15. Small Setups One of the most complicated aspects of setting up a Git server is user management. If you want some repositories to be read-only to certain users and read/write to others, access and permissions can be a bit difficult to arrange. Have your SSH server authenticate from an LDAP server or some other centralized authentication source SSH Access Set up accounts for everybody, which is straightforward but can be cumbersome Create a single ‘git’ user on the machine, ask every user who is to have write access to send you an SSH public key, and add that key to the ~/.ssh/authorized_keys file of your new ‘git’ user.
  • 16. Generating Your SSH Public Key $ cd ~/.ssh $ ls authorized_keys2 id_dsa known_hosts config id_dsa.pub $ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/Users/schacon/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/schacon/.ssh/id_rsa. Your public key has been saved in /Users/schacon/.ssh/id_rsa.pub. The key fingerprint is: 43:c5:5b:5f:b1:f1:50:43:ad:20:a6:92:6a:1f:9a:3a schacon@agadorlaptop.local
  • 17. Generating Your SSH Public Key $ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx NrRFi9wrf+M7Q== schacon@agadorlaptop.local Now, each user that does this has to send their public key to you or whoever is administrating the Git server (assuming you’re using an SSH server setup that requires public keys). All they have to do is copy the contents of the .pub file and e-mail it More Info : http://github.com/guides/providing-your-ssh-key
  • 18. Setting Up the Server $ sudo adduser git $ su git $ cd $ mkdir .ssh You just append them to your authorized_keys file: $ cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys $ cat /tmp/id_rsa.josie.pub >> ~/.ssh/authorized_keys $ cat /tmp/id_rsa.jessica.pub >> ~/.ssh/authorized_keys $ cd /opt/git $ mkdir project.git $ cd project.git $ git --bare init
  • 19. Setting Up the Server # on Johns computer $ cd myproject $ git init $ git add . $ git commit -m 'initial commit' $ git remote add origin git@gitserver:/opt/git/project.git $ git push origin master At this point, the others can clone it down and push changes back up just as easily: $ git clone git@gitserver:/opt/git/project.git $ vim README $ git commit -am 'fix for the README file' $ git push origin master
  • 20. Setting Up the Server As an extra precaution, you can easily restrict the ‘git’ user to only doing Git activities with a limited shell tool called git-shell that comes with Git. If you set this as your ‘git’ user’s login shell, then the ‘git’ user can’t have normal shell access to your server. $ sudo vim /etc/passwd At the bottom, you should find a line that looks something like this: git:x:1000:1000::/home/git:/bin/sh git:x:1000:1000::/home/git:/usr/bin/git-shell $ ssh git@gitserver fatal: What do you think I am? A shell? Connection to gitserver closed.
  • 21. Public Access Enable the hook: $ cd project.git $ mv hooks/post-update.sample hooks/post-update $ chmod a+x hooks/post-update <VirtualHost *:80> ServerName git.gitserver DocumentRoot /opt/git $ chgrp -R www-data /opt/git <Directory /opt/git/> Order allow, deny allow from all </Directory> </VirtualHost> $ git clone http://git.gitserver/project.git
  • 22. GitWeb $ git instaweb --httpd=webrick [2009-02-21 10:02:21] INFO WEBrick 1.3.1 [2009-02-21 10:02:21] INFO ruby 1.8.6 (2008-03-03) [universal-darwin9.0] $ git instaweb --httpd=webrick --stop
  • 23. GitWeb Installation from Source Code $ git clone git://git.kernel.org/pub/scm/git/git.git $ cd git/ $ make GITWEB_PROJECTROOT="/opt/git" prefix=/usr gitweb/gitweb.cgi $ sudo cp -Rf gitweb /var/www/ <VirtualHost *:80> ServerName gitserver DocumentRoot /var/www/gitweb <Directory /var/www/gitweb> Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch AllowOverride All order allow,deny Allow from all AddHandler cgi-script cgi DirectoryIndex gitweb.cgi </Directory> </VirtualHost>
  • 24. GitWeb Binary (Ubuntu/RHEL) Howto : http://bit.ly/OyTH8
  • 25. Gitosis On Ubuntu apt-get install python-setuptools $ git clone git://eagain.net/gitosis.git $ cd gitosis $ sudo python setup.py install $ ln -s /opt/git /home/git/repositories $ mv /home/git/.ssh/authorized_keys /home/git/.ssh/ak.bak
  • 26. Gitosis git:x:1000:1000::/home/git:/usr/bin/git-shell git:x:1000:1000::/home/git:/bin/sh $ sudo -H -u git gitosis-init < /tmp/id_dsa.pub Initialized empty Git repository in /opt/git/gitosis-admin.git/ Reinitialized existing Git repository in /opt/git/gitosis-admin.git/ $ sudo chmod 755 /opt/git/gitosis-admin.git/hooks/post-update
  • 27. Gitosis $ ssh git@gitserver PTY allocation request failed on channel 0 fatal: unrecognized command 'gitosis-serve schacon@quaternion' Connection to gitserver closed. # on your local computer $ git clone git@gitserver:gitosis-admin.git $ cd gitosis-admin $ cat gitosis.conf $ find . [gitosis] ./gitosis.conf ./keydir [group gitosis-admin] ./keydir/scott.pub writable = gitosis-admin members = scott
  • 28. Gitosis Create a new project called iphone_project to start on: [group mobile] writable = iphone_project members = scott Whenever you make changes to the gitosis-admin project, you have to commit the changes and push them back up to the server in order for them to take effect: $ git commit -am 'add iphone_project and mobile group' [master]: created 8962da8: "changed name" 1 files changed, 4 insertions(+), 0 deletions(-) $ git push Counting objects: 5, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 272 bytes, done. Total 3 (delta 1), reused 0 (delta 0) To git@gitserver:/opt/git/gitosis-admin.git fb27aec..8962da8 master -> master
  • 30. Reference ● ProGit, Scott Chacon, Apress ● Just Enough Developed Infrastructure