-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create_Operation.txt
146 lines (87 loc) · 3.26 KB
/
Create_Operation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
! Create New User !
# add new group
# groupadd dev
# add new user
# useradd -G devs -d /home/gituser -m -s /bin/bash gituser
# change password
# passwd gituser
! Create a Bare Repository !
$ pwd
Show the current directory
/c/Users/Fawad4bros/Desktop/Git_TP
$ mkdir project.git
Make a folder project.git
$ cd project.git/
Change directory
/c/Users/Fawad4bros/Desktop/Git_TP/project.git
$ ls
ls lists the files in the current working directory
$ git --bare init
Initialized empty Git repository in C:/Users/Fawad4bros/Desktop/Git_TP/project.git/
$ ls
ls lists the files in the current working directory
branches config description HEAD hooks info objects refs
! Generate Public/Private RSA Key Pair !
Configuring a Git server, ssh-keygen utility generates public/private RSA key pair,
that we will use for user authentication.
It will create a .ssh directory inside the home directory.
$ pwd
/c/Users/Fawad4bros/Desktop/Git_TP/project.git/
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Fawad4bros/.ssh/id_rsa):
Created directory '/c/Users/Fawad4bros/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /*/*****/*****4****/.ssh/id_rsa (Private Key)
Your public key has been saved in /*/*****/*****4****/.ssh/id_rsa.pub (Public Key)
The key fingerprint is:
******:0**q**Sx***Fx****5zlNC*****EWp*******gYK2j8 F****4****@D*****P-4****TQ
The key's randomart image is:
+---[RSA 3072]----+
|. ..++o . |
|.o . o.+o+ + . |
|. o .=..o*.o |
| o.oo+.+=.. |
| o E.=+S=.o |
| . . =.++o. |
| . ..= |
| . o.. |
| .oo |
+----[SHA256]-----+
ssh-keygen has generated two keys, first one is private (i.e., id_rsa)
and the second one is public (i.e., id_rsa.pub).
Note: Never share your PRIVATE KEY with others.
**************************** unclear *********************************
! Adding Keys to authorized_keys !
Suppose there are two developers working on a project, namely fawad and Jerry.
Both users have generated public keys. Let us see how to use these keys for authentication.
fawad added his public key to the server by using ssh-copy-id command as given below −
$ pwd
/c/Users/Fawad4bros/Desktop/Git_TP/project.git
$ ssh-copy-id -i ~/.ssh/id_rsa.pub Fawad4bros@DESKTOP-4MCNLTQ
**************************** unclear *********************************
! Push Changes to the Repository !
Git init command creates .git directory to store metadata about the repository every time
it reads the configuration from the .git/config file.
Fawad creates a new directory, adds README file, and commits his change as initial commit.
After commit, he verifies the commit message by running the git log command.
$ pwd
$ mkdir fawad
$ cd fawad/
$ git init
Initialized empty Git repository in /home/tom/tom_repo/.git/
$ echo 'TODO: Add contents for README' > README
$ git status -s
?? README
$ git add .
$ git status -s
A README
$ git commit -m 'Initial commit'
$ git log
commit 8fe676ea37320e4e1655d4019c035011d43a4c90 (HEAD -> master)
Author: fawad4bros <fawad4bros@gmail.com>
Date: Sat Mar 13 17:03:57 2021 +0500
Initial commit
$ git remote add origin Fawad4bros@DESKTOP-4MCNLTQ:project.git
$ git push origin master