SlideShare a Scribd company logo
1 of 42
2010   11           13




       .    .   .    .   .   .
.
                                 Git
             etckeeper
.

            mkouhei@debian.or.jp
     all id: mkouhei


    2010 11     13
     2012 1     4




                         .   .    .    .   .   .
:       ,       @IT
                      ,        ,             KVM
(mkouhei)
                                           KVM
GPG KeyID :               :R&D,            (                                    )
4096R/7E37CE41
                                           @IT
Debian JP Project,                                   !CouchDB
          Debian                                            #5
                     Debian
                     Ubuntu                (                        )
                                           Git
                                                                (
                                                            )




                                       .         .      .       .       .   .
/etc




       .   .   .   .   .   .
.   .   .   .   .   .
tab




      .   .   .   .   .   .
rcs




      .   .   .   .   .   .
Subversion




             .   .   .   .   .   .
Git




      .   .   .   .   .   .
Git                                 ?


                Git


                    git add      index       git commit
                                                                                 git push
working directory             git checkout                    local repository              remote repository
                                                                                 git pull




                                                          1
                                                                                 index
    VCS                               Git                          VCS




1
           VCS                                                               .       .      .        .          .   .
etckeeper




            .   .   .   .   .   .
/etc   VCS

apt yum
cron
Git, mercurial, bazaar, darcs




                                .   .   .   .   .   .
2
                 Git
$ sudo apt-get install etckeeper




$ ls -ld /etc/.git
drwx------ 8 root root 4096 2010-11-12 07:48 /etc/.git




 2
     Debian                                   .    .     .       .   .   .
etckeeper               Git
     etckeeper init           git   config
     etckeeper commit         git   log
                              git   diff
                              git   remote add
                              git   push
                              git   pull




                                      .   .      .   .   .   .
Git                etckeeper
        git   init         etckeeper   init
        git   config        etckeeper   vcs config
        git   status       etckeeper   vcs status
        git   diff          etckeeper   vcs diff
index   git   add          etckeeper   vcs add
        git   commit       etckeeper   commit
        git   remote add   etckeeper   vcs remote add
        git   push         etckeeper   vcs push
        git   pull         etckeeper   vcs pull




                            .     .       .     .       .   .
ITIL

      変更履歴の確認                         etckeeper vcs log
                                                                          git log

    変更作業                      vi hoge.conf


                                                              vi hoge.conf
  変更内容確認                 etckeeper vcs diff




  変更状況確認               etckeeper vcs status                     git diff



コミットの事前登録                etckeeper vcs add
                                                               git status


  コミット                   etckeeper commit


                                                                 git add
 コミットログ確認                 etckeeper vcs log




                                  etckeeper vcs push           git commit
      バックアップ




                                                                     git log




                                                                           git push



                                                          .      .             .      .   .   .
.   .   .   .   .   .
Git




         user.name, user.email

      $ git config user.name=’Gonbeh Nanashi’
      $ git config user.email=’gonbeh@example.com’




                                                     .   .   .   .   .   .
etckeeper




   $ ls -ld /etc/.git
   drwx------ 8 root root 4096 2010-11-12 07:48 /etc/.git




                                                 .    .     .   .   .   .
Why?




       .   .   .   .   .   .
/etc/shadow
iptables
tripwire




              .   .   .   .   .   .
.   .   .   .   .   .
$ git log :/Initial
commit 0a6703b7ac1f521faff1a1b1c7d65a0b104301de
Author: Gonbeh Nanashi <gonbeh@example.com>
Date:   Mon May 3 02:08:50 2010 +0900
    Initial commit
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
(stdin):

                                              .   .   .   .   .   .
.
1



    $ cd /etc; sudo vi /etc/hosts


.
2



    $ sudo etckeeper vcs status
    $ sudo etckeeper vcs diff


.
3



    $ sudo etckeeper commit ’add new hosts entries.’




                                            .    .     .   .   .   .
Git   index
add

                    (ry




                .         .   .   .   .   .
Git
      .
      1



          $ cd /etc; sudo vi /etc/hosts


      .
      2



          $ sudo git status
          $ sudo git diff


      . index
      3



          $ sudo git add hosts


      .
      4



          $ sudo git commit -sm ’add new hosts entries.’


                                                  .    .   .   .   .   .
etckeeper     Git


      Git    VCS
      commit               git commit -a
                                (init)             (commit)

      root

        1. git
        2. etckeeper vcs subcommand




                                           .   .    .   .     .   .
git




      .   .   .   .   .   .
etckeeper




      /etc

             apt yum
             cron




                       .   .   .   .   .   .
etckeeper




            .   .   .   .   .   .
.   .   .   .   .   .
.   .   .   .   .   .
/etc

                                                       etckeeper
        Srv0
        push



            Client
       198.51.100.100

        local repos




                                                Srv0                                                    Srv1                     Srv2                      Srv3
                                            198.51.100.1                                            198.51.100.11            198.51.100.12             198.51.100.13

       remote repos        local repos                                                                                        local repos               local repos
                                                                                                     local repos(/etc)
         (gitosis)            (/etc)                                                                                             (/etc)                    (/etc)


             git pull           git push                                         git push                         git push                  git push


                         remote repos       remote repos       remote repos       remote repos
       local repos
                        (Srv0 /etc bkup)   (Srv1 /etc bkup)   (Srv2 /etc bkup)   (Srv3 /etc bkup)




                                                                                                      .             .          .            .             .           .
sshd(/etc/ssh/sshd config)



     root    push                root
       PermitRootLogin yes




       PasswordAuthentication no
       ChallengeResponseAuthentication no




                                            .   .   .   .   .   .
ssh   root




             .   .   .   .   .   .
.   .   .   .   .   .
root                           (/root/.ssh/authorized keys)

                     IP
            from=’198.51.100.1?’




            no-pty




       from="198.51.100.1?",no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAx5v6Na2jwzE6xG
       ah8MVY0Odbi/1oMC6OYolFo3e//Ysacn8r7XOAXIiQvryuIUgzclmJag7EhnfB3pzpNxhu1Ai0c1th
       ciwdmdZyM+tGGwcrfXERrsipBPbQsr2eMiOX7oX0MQJEHF0qt97EZmIhZ60rS+KfyA1EzIWLDL8Avd
       h/2MoHwJG6YJqAwkqcvU61DHawLlyNN/XmrXEsObg+APJrvJNXGcu7u6iWBpjeKORuuOkX2rGoESWz
       OZHtJooZQbzdfjyu3pTrriQLnk9gdYV2Xj7ax8W853n9lZa8JBilleoRfBE192E4fDb4/mMjQPcMTp
       ywb7QQ== root@example.com



                                                     .    .    .    .    .    .
/var/lib/etckeeper/etc host
                         3


      $ sudo mkdir -p /var/lib/etckeeper/etc_Srv{0,1,2,3}
      $ sudo chmod 700 /var/lib/etckeeper/etc_Srv[0-3]




      $ cd /var/lib/etckeeper/etc_Srv0; sudo git init --bare
      $ cd ../etc_Srv1; (       )




3
    path                                      .    .    .      .   .   .
/etc



$ cd /etc
$ sudo git remote add backup ssh://Srv0/etc-Srv1


        (                                   )
$ sudo git push backup --all




                                        .       .   .   .   .   .
etckeeper




                                      =
                   sudo

      ssh   root




                          .   .   .       .   .   .
etckeeper




                                  4

         1




    4
        gitosis   .   .   .   .       .   .
Git
(         )



              .   .   .   .   .   .

More Related Content

What's hot

Startup Containers in Lightning Speed with Lazy Image Distribution
Startup Containers in Lightning Speed with Lazy Image DistributionStartup Containers in Lightning Speed with Lazy Image Distribution
Startup Containers in Lightning Speed with Lazy Image DistributionKohei Tokunaga
 
Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshopNicolas Degardin
 
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動するStargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動するKohei Tokunaga
 
Criminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and FutureCriminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and FutureJim Lippard
 
The event-driven nature of javascript – IPC2012
The event-driven nature of javascript – IPC2012The event-driven nature of javascript – IPC2012
The event-driven nature of javascript – IPC2012Martin Schuhfuß
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'acorehard_by
 
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
Faster Container Image Distribution on a Variety of Tools with Lazy PullingFaster Container Image Distribution on a Variety of Tools with Lazy Pulling
Faster Container Image Distribution on a Variety of Tools with Lazy PullingKohei Tokunaga
 
Building More with Less
Building More with LessBuilding More with Less
Building More with Lessdonnfelker
 
Porting Gentoo to DragonFly
Porting Gentoo to DragonFlyPorting Gentoo to DragonFly
Porting Gentoo to DragonFlyNaohiro Aota
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory AnalysisMoabi.com
 
Making Security Invisible
Making Security InvisibleMaking Security Invisible
Making Security InvisibleJ On The Beach
 
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
The overview of lazypull with containerd Remote Snapshotter & Stargz SnapshotterThe overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
The overview of lazypull with containerd Remote Snapshotter & Stargz SnapshotterKohei Tokunaga
 
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析Mr. Vengineer
 
Using QEMU for cross development
Using QEMU for cross developmentUsing QEMU for cross development
Using QEMU for cross developmentTetsuyuki Kobayashi
 
Cooking Perl with Chef: Hello World Tutorial
Cooking Perl with Chef: Hello World TutorialCooking Perl with Chef: Hello World Tutorial
Cooking Perl with Chef: Hello World TutorialDavid Golden
 
Docker architecture rework case study
Docker  architecture rework case studyDocker  architecture rework case study
Docker architecture rework case studydchaffiol
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernelJohnson Chou
 
Linux: the first second
Linux: the first secondLinux: the first second
Linux: the first secondAlison Chaiken
 

What's hot (20)

Startup Containers in Lightning Speed with Lazy Image Distribution
Startup Containers in Lightning Speed with Lazy Image DistributionStartup Containers in Lightning Speed with Lazy Image Distribution
Startup Containers in Lightning Speed with Lazy Image Distribution
 
Logging system of Android
Logging system of AndroidLogging system of Android
Logging system of Android
 
Tribal Nova Docker workshop
Tribal Nova Docker workshopTribal Nova Docker workshop
Tribal Nova Docker workshop
 
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動するStargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
Stargz Snapshotter: イメージのpullを省略しcontainerdでコンテナを高速に起動する
 
Criminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and FutureCriminals in the Cloud: Past, Present, and Future
Criminals in the Cloud: Past, Present, and Future
 
The event-driven nature of javascript – IPC2012
The event-driven nature of javascript – IPC2012The event-driven nature of javascript – IPC2012
The event-driven nature of javascript – IPC2012
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
Faster Container Image Distribution on a Variety of Tools with Lazy PullingFaster Container Image Distribution on a Variety of Tools with Lazy Pulling
Faster Container Image Distribution on a Variety of Tools with Lazy Pulling
 
Building More with Less
Building More with LessBuilding More with Less
Building More with Less
 
Porting Gentoo to DragonFly
Porting Gentoo to DragonFlyPorting Gentoo to DragonFly
Porting Gentoo to DragonFly
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
Making Security Invisible
Making Security InvisibleMaking Security Invisible
Making Security Invisible
 
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
The overview of lazypull with containerd Remote Snapshotter & Stargz SnapshotterThe overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
The overview of lazypull with containerd Remote Snapshotter & Stargz Snapshotter
 
Alta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/LinuxAlta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/Linux
 
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
RISC-V : Berkeley Boot Loader & Proxy Kernelのソースコード解析
 
Using QEMU for cross development
Using QEMU for cross developmentUsing QEMU for cross development
Using QEMU for cross development
 
Cooking Perl with Chef: Hello World Tutorial
Cooking Perl with Chef: Hello World TutorialCooking Perl with Chef: Hello World Tutorial
Cooking Perl with Chef: Hello World Tutorial
 
Docker architecture rework case study
Docker  architecture rework case studyDocker  architecture rework case study
Docker architecture rework case study
 
Introduction of unit test on android kernel
Introduction of unit test on android kernelIntroduction of unit test on android kernel
Introduction of unit test on android kernel
 
Linux: the first second
Linux: the first secondLinux: the first second
Linux: the first second
 

Similar to インフラエンジニアのためのGit入門

Similar to インフラエンジニアのためのGit入門 (20)

Git and Github
Git and GithubGit and Github
Git and Github
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
T3dd10 git
T3dd10 gitT3dd10 git
T3dd10 git
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git
GitGit
Git
 
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
 
Using git in eclipse by Chris Aniszczyk
Using git in eclipse by Chris AniszczykUsing git in eclipse by Chris Aniszczyk
Using git in eclipse by Chris Aniszczyk
 
Git cheat-sheets
Git cheat-sheetsGit cheat-sheets
Git cheat-sheets
 
Getting started with git
Getting started with gitGetting started with git
Getting started with git
 
How to use git without rage
How to use git without rageHow to use git without rage
How to use git without rage
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git
GitGit
Git
 
Git Heaven with Wakanda
Git Heaven with WakandaGit Heaven with Wakanda
Git Heaven with Wakanda
 
Git Going With DVCS v1.5.2
Git Going With DVCS v1.5.2Git Going With DVCS v1.5.2
Git Going With DVCS v1.5.2
 
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
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
M.Mozūras - git
M.Mozūras - gitM.Mozūras - git
M.Mozūras - git
 
Git Going at JavaZone 2010
Git Going at JavaZone 2010Git Going at JavaZone 2010
Git Going at JavaZone 2010
 
Git! Why? How?
Git! Why? How?Git! Why? How?
Git! Why? How?
 

More from Kouhei Maeda

とあるWeb企業でのDebianシステムの使い方。
とあるWeb企業でのDebianシステムの使い方。とあるWeb企業でのDebianシステムの使い方。
とあるWeb企業でのDebianシステムの使い方。Kouhei Maeda
 
ldapvi & python-ldap で stress-free life
ldapvi & python-ldap で stress-free lifeldapvi & python-ldap で stress-free life
ldapvi & python-ldap で stress-free lifeKouhei Maeda
 
Git pyfes201207-presen
Git pyfes201207-presenGit pyfes201207-presen
Git pyfes201207-presenKouhei Maeda
 
Lxc cf201207-presen
Lxc cf201207-presenLxc cf201207-presen
Lxc cf201207-presenKouhei Maeda
 
Goodby Hatena, hello Sphinx
Goodby Hatena, hello SphinxGoodby Hatena, hello Sphinx
Goodby Hatena, hello SphinxKouhei Maeda
 
僕の疑問に答えてください。
僕の疑問に答えてください。僕の疑問に答えてください。
僕の疑問に答えてください。Kouhei Maeda
 
Debian JP会長就任の挨拶
Debian JP会長就任の挨拶Debian JP会長就任の挨拶
Debian JP会長就任の挨拶Kouhei Maeda
 
Debianでできる簡単監視システム。
Debianでできる簡単監視システム。Debianでできる簡単監視システム。
Debianでできる簡単監視システム。Kouhei Maeda
 
Debianでできる簡単監視システム
Debianでできる簡単監視システムDebianでできる簡単監視システム
Debianでできる簡単監視システムKouhei Maeda
 
CouchDB on Androidでスタンドアローンアプリ。
CouchDB on Androidでスタンドアローンアプリ。CouchDB on Androidでスタンドアローンアプリ。
CouchDB on Androidでスタンドアローンアプリ。Kouhei Maeda
 
あいぽん落としたと聞いたので!
あいぽん落としたと聞いたので!あいぽん落としたと聞いたので!
あいぽん落としたと聞いたので!Kouhei Maeda
 
エンジニアのための痔の話
エンジニアのための痔の話エンジニアのための痔の話
エンジニアのための痔の話Kouhei Maeda
 
S2s websrv201011-presen
S2s websrv201011-presenS2s websrv201011-presen
S2s websrv201011-presenKouhei Maeda
 

More from Kouhei Maeda (13)

とあるWeb企業でのDebianシステムの使い方。
とあるWeb企業でのDebianシステムの使い方。とあるWeb企業でのDebianシステムの使い方。
とあるWeb企業でのDebianシステムの使い方。
 
ldapvi & python-ldap で stress-free life
ldapvi & python-ldap で stress-free lifeldapvi & python-ldap で stress-free life
ldapvi & python-ldap で stress-free life
 
Git pyfes201207-presen
Git pyfes201207-presenGit pyfes201207-presen
Git pyfes201207-presen
 
Lxc cf201207-presen
Lxc cf201207-presenLxc cf201207-presen
Lxc cf201207-presen
 
Goodby Hatena, hello Sphinx
Goodby Hatena, hello SphinxGoodby Hatena, hello Sphinx
Goodby Hatena, hello Sphinx
 
僕の疑問に答えてください。
僕の疑問に答えてください。僕の疑問に答えてください。
僕の疑問に答えてください。
 
Debian JP会長就任の挨拶
Debian JP会長就任の挨拶Debian JP会長就任の挨拶
Debian JP会長就任の挨拶
 
Debianでできる簡単監視システム。
Debianでできる簡単監視システム。Debianでできる簡単監視システム。
Debianでできる簡単監視システム。
 
Debianでできる簡単監視システム
Debianでできる簡単監視システムDebianでできる簡単監視システム
Debianでできる簡単監視システム
 
CouchDB on Androidでスタンドアローンアプリ。
CouchDB on Androidでスタンドアローンアプリ。CouchDB on Androidでスタンドアローンアプリ。
CouchDB on Androidでスタンドアローンアプリ。
 
あいぽん落としたと聞いたので!
あいぽん落としたと聞いたので!あいぽん落としたと聞いたので!
あいぽん落としたと聞いたので!
 
エンジニアのための痔の話
エンジニアのための痔の話エンジニアのための痔の話
エンジニアのための痔の話
 
S2s websrv201011-presen
S2s websrv201011-presenS2s websrv201011-presen
S2s websrv201011-presen
 

Recently uploaded

Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
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
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
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
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
#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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
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
 

Recently uploaded (20)

Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
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
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
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
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
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
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
#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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
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
 
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...
 

インフラエンジニアのためのGit入門

  • 1. 2010 11 13 . . . . . .
  • 2. . Git etckeeper . mkouhei@debian.or.jp all id: mkouhei 2010 11 13 2012 1 4 . . . . . .
  • 3. : , @IT , , KVM (mkouhei) KVM GPG KeyID : :R&D, ( ) 4096R/7E37CE41 @IT Debian JP Project, !CouchDB Debian #5 Debian Ubuntu ( ) Git ( ) . . . . . .
  • 4. /etc . . . . . .
  • 5. . . . . . .
  • 6. tab . . . . . .
  • 7. rcs . . . . . .
  • 8. Subversion . . . . . .
  • 9. Git . . . . . .
  • 10. Git ? Git git add index git commit git push working directory git checkout local repository remote repository git pull 1 index VCS Git VCS 1 VCS . . . . . .
  • 11. etckeeper . . . . . .
  • 12. /etc VCS apt yum cron Git, mercurial, bazaar, darcs . . . . . .
  • 13. 2 Git $ sudo apt-get install etckeeper $ ls -ld /etc/.git drwx------ 8 root root 4096 2010-11-12 07:48 /etc/.git 2 Debian . . . . . .
  • 14. etckeeper Git etckeeper init git config etckeeper commit git log git diff git remote add git push git pull . . . . . .
  • 15. Git etckeeper git init etckeeper init git config etckeeper vcs config git status etckeeper vcs status git diff etckeeper vcs diff index git add etckeeper vcs add git commit etckeeper commit git remote add etckeeper vcs remote add git push etckeeper vcs push git pull etckeeper vcs pull . . . . . .
  • 16. ITIL 変更履歴の確認 etckeeper vcs log git log 変更作業 vi hoge.conf vi hoge.conf 変更内容確認 etckeeper vcs diff 変更状況確認 etckeeper vcs status git diff コミットの事前登録 etckeeper vcs add git status コミット etckeeper commit git add コミットログ確認 etckeeper vcs log etckeeper vcs push git commit バックアップ git log git push . . . . . .
  • 17. . . . . . .
  • 18. Git user.name, user.email $ git config user.name=’Gonbeh Nanashi’ $ git config user.email=’gonbeh@example.com’ . . . . . .
  • 19. etckeeper $ ls -ld /etc/.git drwx------ 8 root root 4096 2010-11-12 07:48 /etc/.git . . . . . .
  • 20. Why? . . . . . .
  • 22. . . . . . .
  • 23. $ git log :/Initial commit 0a6703b7ac1f521faff1a1b1c7d65a0b104301de Author: Gonbeh Nanashi <gonbeh@example.com> Date: Mon May 3 02:08:50 2010 +0900 Initial commit ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ (stdin): . . . . . .
  • 24. . 1 $ cd /etc; sudo vi /etc/hosts . 2 $ sudo etckeeper vcs status $ sudo etckeeper vcs diff . 3 $ sudo etckeeper commit ’add new hosts entries.’ . . . . . .
  • 25. Git index add (ry . . . . . .
  • 26. Git . 1 $ cd /etc; sudo vi /etc/hosts . 2 $ sudo git status $ sudo git diff . index 3 $ sudo git add hosts . 4 $ sudo git commit -sm ’add new hosts entries.’ . . . . . .
  • 27. etckeeper Git Git VCS commit git commit -a (init) (commit) root 1. git 2. etckeeper vcs subcommand . . . . . .
  • 28. git . . . . . .
  • 29. etckeeper /etc apt yum cron . . . . . .
  • 30. etckeeper . . . . . .
  • 31. . . . . . .
  • 32. . . . . . .
  • 33. /etc etckeeper Srv0 push Client 198.51.100.100 local repos Srv0 Srv1 Srv2 Srv3 198.51.100.1 198.51.100.11 198.51.100.12 198.51.100.13 remote repos local repos local repos local repos local repos(/etc) (gitosis) (/etc) (/etc) (/etc) git pull git push git push git push git push remote repos remote repos remote repos remote repos local repos (Srv0 /etc bkup) (Srv1 /etc bkup) (Srv2 /etc bkup) (Srv3 /etc bkup) . . . . . .
  • 34. sshd(/etc/ssh/sshd config) root push root PermitRootLogin yes PasswordAuthentication no ChallengeResponseAuthentication no . . . . . .
  • 35. ssh root . . . . . .
  • 36. . . . . . .
  • 37. root (/root/.ssh/authorized keys) IP from=’198.51.100.1?’ no-pty from="198.51.100.1?",no-pty ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAx5v6Na2jwzE6xG ah8MVY0Odbi/1oMC6OYolFo3e//Ysacn8r7XOAXIiQvryuIUgzclmJag7EhnfB3pzpNxhu1Ai0c1th ciwdmdZyM+tGGwcrfXERrsipBPbQsr2eMiOX7oX0MQJEHF0qt97EZmIhZ60rS+KfyA1EzIWLDL8Avd h/2MoHwJG6YJqAwkqcvU61DHawLlyNN/XmrXEsObg+APJrvJNXGcu7u6iWBpjeKORuuOkX2rGoESWz OZHtJooZQbzdfjyu3pTrriQLnk9gdYV2Xj7ax8W853n9lZa8JBilleoRfBE192E4fDb4/mMjQPcMTp ywb7QQ== root@example.com . . . . . .
  • 38. /var/lib/etckeeper/etc host 3 $ sudo mkdir -p /var/lib/etckeeper/etc_Srv{0,1,2,3} $ sudo chmod 700 /var/lib/etckeeper/etc_Srv[0-3] $ cd /var/lib/etckeeper/etc_Srv0; sudo git init --bare $ cd ../etc_Srv1; ( ) 3 path . . . . . .
  • 39. /etc $ cd /etc $ sudo git remote add backup ssh://Srv0/etc-Srv1 ( ) $ sudo git push backup --all . . . . . .
  • 40. etckeeper = sudo ssh root . . . . . .
  • 41. etckeeper 4 1 4 gitosis . . . . . .
  • 42. Git ( ) . . . . . .