Just enough GiT for Puppet Automation – Part6

All Posts in this Series

 

Cloning the GiT repo to a new machine

You’ll need a second machine similar to the one you have been using so far (either a cloud instance, a Vagrant VM, or a physical machine, whichever is convenient/
Once the machine is set up, create the git user:

igurkul@demo2:~$ sudo useradd -m git

1. Create a .ssh directory and private key file, and set appropriate permissions:

igurkul@demo2:~$ sudo su – git
igurkul@demo2:~$ mkdir .ssh
igurkul@demo2:~$ chmod 700 .ssh
igurkul@demo2:~$ touch .ssh/id_rsa
igurkul@demo2:~$ chmod 600 .ssh/id_rsa

2. On your first server, display the SSH private key for git and copy it to the clipboard:

igurkul@demo:~$ sudo cat ~git/.ssh/id_rsa
—–BEGIN RSA PRIVATE KEY—–
MIIEowIBAAKCAQEA1wR9i+bkwsNIcyd1ojhBH13ecuOhGfoJpjdjSjocBjf2fJRa

GOTLXyqpcrez/Ijbc9TJsaFNisnb1HqBR31J/N2StjHmwjtOmlwL
—–END RSA PRIVATE KEY—–

3. Now edit the private key file on the new server:

igurkul@demo2:~$ vi .ssh/id_rsa

4. Press i to enter insert mode and paste the key from the clipboard:

—–BEGIN RSA PRIVATE KEY—–
MIIEowIBAAKCAQEA1wR9i+bkwsNIcyd1ojhBH13ecuOhGfoJpjdjSjocBjf2fJRa

GOTLXyqpcrez/Ijbc9TJsaFNisnb1HqBR31J/N2StjHmwjtOmlwL
—–END RSA PRIVATE KEY—–

5. Save the file and exit (:wq).

6. Test the private key by logging into the old server from the new (use the public IP address of your first server):

igurkul@demo2:~$ ssh git@23.20.119.201
The authenticity of host ‘23.20.119.201 (23.20.119.201)’ can’t be established.
ECDSA key fingerprint is 29:9d:2a:09:85:d1:2d:24:a2:e5:ff:0a:4a:75:c2:6b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘23.20.119.201’ (ECDSA) to the list of known hosts.
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-29-virtual x86_64)

7. You should now be able to clone the repo onto the new machine:

igurkul@demo2:~$ git clone 23.20.119.201:/var/git/puppet.git
Cloning into ‘puppet’…
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 17 (delta 1), reused 0 (delta 0)
Receiving objects: 100% (17/17), 1.27 KiB, done.
Resolving deltas: 100% (1/1), done.

 


Details about oour upcoming Puppet Automation Workshop:


More Details : 
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us

What is your Learning Goal for Next Six Months ? Talk to us