TEXT   124
git
Guest on 31st May 2022 01:54:40 PM


  1. ====== GIT ======
  2.  
  3. ===== Installation on debian =====
  4.  
  5.   apt update
  6.   apt upgrade
  7.   apt install git
  8.  
  9. ===== Getting Started =====
  10.  
  11.   CD /
  12.   mkdir git
  13.   git config
  14.   git config --global user.name "Charles"
  15.   git config --global user.email "cc@mail.com"
  16.  
  17. ===== Checking settings =====
  18.  
  19.   git config --list
  20.  
  21.   nano ~/.gitconfig
  22.  
  23.   git config user.name
  24.  
  25.  
  26. ===== Help =====
  27.  
  28.   git help
  29.  
  30.   git help config
  31.  
  32. ==== Initializing a repository in an existing directory ====
  33.  
  34.   git start
  35.  
  36. empty Git repository in /git/.git/
  37.  
  38.     ls .git
  39.  
  40. HEAD branches config description hooks info objects refs
  41.  
  42. ==== Uploading files ====
  43.  
  44.   nano firstfile.txt // write something inside
  45.  
  46.   git add firstfile.txt // add the file
  47.  
  48.   git commit -m 'first file uploaded'
  49.  
  50. [master (root-commit) 454b8e8] first file uploaded
  51.  1 file changed, 3 insertions(+)
  52.  create mode 100644 firstfile.txt
  53.  
  54.  
  55. ==== Generate ssh-keygen ====
  56.  
  57.   ssh-keygen // carlos__--
  58.  
  59.   cd @/.ssh
  60.   ls // id_rsa id_rsa.pub
  61.  
  62. From git@git:~/
  63.  
  64.   touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
  65.  
  66.  
  67.  
  68. ==== We generate the keys in the user who wants to connect to git ====
  69.  
  70.   carlos@deb412:~$ ssh-keygen
  71.   /home/carlos/.ssh/id_rsa.carlos.deb412
  72.   Charles__--
  73.  
  74. In .ssh id_rsa.carlos.deb412 and id_rsa.carlos.deb412.pub will appear
  75.  
  76. ==== Now this public key should be added to the authorized file on the git server ====
  77.  
  78. Upload the key to the server:
  79.  
  80.   git@git:~/.ssh$ scp -r carlos@192.168.4.102:/home/carlos/.ssh/id_rsa.carlos.deb412.pub ~/.ssh
  81.  
  82. Copy it into authorized_keys
  83.  
  84.   git@git:~/.ssh$ cat id_rsa.carlos.deb412.pub >> authorized_keys
  85.  
  86.  
  87.  
  88. ==== We create a .git project on the git server ====
  89.  
  90.   git@git:~/$ mkdir project.git
  91.   cd project.git
  92.   git init --bare
  93.  
  94. Initilized empty Git repository in /home/git/project.git/
  95.  
  96.  
  97. ==== From the client carlos@deb412 ====
  98.  
  99. First install git (if not already installed)
  100.  
  101.   root@deb412:/home/carlos# apt install git
  102.  
  103. From the user:
  104.  
  105.   carlos@deb412:~$ mkdir git-project
  106.   carlos@deb412:~$ cd git-project
  107.   carlos@deb412:~/git-project$ git init
  108.  
  109. Initilized empty Gir repository in /home/carlos/git-project/.git
  110.  
  111.   git add .
  112.   git commit -m 'Initial commit'
  113.  
  114.   git remote add source git@192.168.4.11:/home/git/project.git
  115.  
  116.   git push source master
  117.  
  118.   git clone git@192.168.4.11:/home/git/project.git
  119.  
  120.   cd project
  121.   nano READ ME
  122.  
  123.   git add LEEM
  124.   git commit -am 'README file'
  125.  
  126.   git push source master
  127.  
  128.   git remote add source git@192.168.4.11:/home/git/project.git
  129.  
  130.   git push source master

Raw Paste

Login or Register to edit or fork this paste. It's free.