1. 자식 설치
yum install git
Last metadata expiration check: 0:08:02 ago on Wed 29 Jun 2022 02:43:07 PM CST.
Dependencies resolved.
======================================================================================================================== Package Architecture Version Repository Size
========================================================================================================================Installing:
git x86_64 2.27.0-1.el8 AppStream 164 k
Installing dependencies:
git-core x86_64 2.27.0-1.el8 AppStream 5.7 M
git-core-doc noarch 2.27.0-1.el8 AppStream 2.5 M
perl-Error noarch 1:0.17025-2.el8 AppStream 46 k
perl-Git noarch 2.27.0-1.el8 AppStream 77 k
perl-TermReadKey x86_64 2.37-7.el8 AppStream 40 k
Transaction Summary
========================================================================================================================Install 6 Packages
Total download size: 8.5 M
Installed size: 45 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): git-2.27.0-1.el8.x86_64.rpm 335 kB/s | 164 kB 00:00
(2/6): perl-Error-0.17025-2.el8.noarch.rpm 291 kB/s | 46 kB 00:00
(3/6): perl-Git-2.27.0-1.el8.noarch.rpm 42 kB/s | 77 kB 00:01
(4/6): perl-TermReadKey-2.37-7.el8.x86_64.rpm 274 kB/s | 40 kB 00:00
(5/6): git-core-doc-2.27.0-1.el8.noarch.rpm 430 kB/s | 2.5 MB 00:05
(6/6): git-core-2.27.0-1.el8.x86_64.rpm 429 kB/s | 5.7 MB 00:13
------------------------------------------------------------------------------------------------------------------------Total 644 kB/s | 8.5 MB 00:13
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : git-core-2.27.0-1.el8.x86_64 1/6
Installing : git-core-doc-2.27.0-1.el8.noarch 2/6
Installing : perl-TermReadKey-2.37-7.el8.x86_64 3/6
Installing : perl-Error-1:0.17025-2.el8.noarch 4/6
Installing : perl-Git-2.27.0-1.el8.noarch 5/6
Installing : git-2.27.0-1.el8.x86_64 6/6
Running scriptlet: git-2.27.0-1.el8.x86_64 6/6
Verifying : git-2.27.0-1.el8.x86_64 1/6
Verifying : git-core-2.27.0-1.el8.x86_64 2/6
Verifying : git-core-doc-2.27.0-1.el8.noarch 3/6
Verifying : perl-Error-1:0.17025-2.el8.noarch 4/6
Verifying : perl-Git-2.27.0-1.el8.noarch 5/6
Verifying : perl-TermReadKey-2.37-7.el8.x86_64 6/6
Installed:
git-2.27.0-1.el8.x86_64 git-core-2.27.0-1.el8.x86_64 git-core-doc-2.27.0-1.el8.noarch
perl-Error-1:0.17025-2.el8.noarch perl-Git-2.27.0-1.el8.noarch perl-TermReadKey-2.37-7.el8.x86_64
Complete!
2. 사용자 이름 및 이메일 구성
git config --global user.name "username"
git config --global user.email "[email protected]"
여기서 global은 전역 사용자 이름과 사서함을 구성하고 –global 매개변수를 제거하며 현재 디렉터리의 웨어하우스에 대해 사용자 이름과 사서함을 별도로 구성할 수 있습니다.
그런 다음 다음 명령을 사용하여 구성을 볼 수 있습니다.
git config --get user.name
3. SSH 구성
-
3.1 SSH 키 생성
$ ssh-keygen -t ed25519 -C "[email protected]"
그러면 제공된 이메일을 레이블로 사용하여 새 SSH 키가 생성됩니다.
ed25519는 암호화 알고리즘입니다.
Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): github Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in github. Your public key has been saved in github.pub. The key fingerprint is: SHA256:sxxxxxxxxxxxxxxxxxxxxxxx xxx@xxx The key's randomart image is: +---[RSA 3072]----+ | ....o ..=| | ..+ = B+| | o . = X *| | + o = * | | . S + . .| | . + + o | | . + o o... | | B . .o.E| | +.+. o+*+| +----[SHA256]-----+
실행 후 키 파일명, 키 비밀번호, 확인 비밀번호를 차례로 입력해야 합니다. 기본값을 직접 입력하여 사용할 수 있습니다.
여기에 파일 이름을 지정합니다. -
3.2 ssh-agent에 SSH 키 추가
eval "$(ssh-agent -s)" $ ssh-add ~/.ssh/github
Identity added: /root/.ssh/github ([email protected])
github를 키 이름으로 바꿉니다.
이 단계를 수행하지 않으면 아래의 세 번째 단계로 바로 건너뛰고 ssh를 사용하여 github에 액세스할 수 없습니다.
ssh -T [email protected] The authenticity of host 'github.com (20.205.243.166)' can't be established. ECDSA key fingerprint is SHA256:pxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx. Are you sure you want to continue connecting (yes/no/[fingerprint])? Y Please type 'yes', 'no' or the fingerprint: yes Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts. [email protected]: Permission denied (publickey).
접근이 금지되어있다.
-
3.3 공개 키 복사, github 열기 - 설정 - 왼쪽 SSH 및 GPG 키 - 새 SSH 키
테스트 액세스
ssh -T [email protected] Hi xxxx! You've successfully authenticated, but GitHub does not provide shell access.
4. SSL을 사용하여 웨어하우스를 로컬에 복제합니다.
git clone [email protected]:user/repo.git
Cloning into 'repo'...
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (39/39), done.
remote: Total 55 (delta 21), reused 47 (delta 13), pack-reused 0
Receiving objects: 100% (55/55), 53.29 KiB | 230.00 KiB/s, done.
Resolving deltas: 100% (21/21), done.
기사 참조: