IT/GIT

[GIT] Mac OS에서 Git 설치하기

음료요정 2021. 8. 30. 18:31

맥 환경에서 git을 한번도 사용해본적이 없어 익히면서 기록 해두려고 작성합니다.

 

환경 

맥 Catalina 10.15.7(19H15)

 

 

단계 

1. homebrew 설치

 homebrew 는 Mac환경에서 유용한 패키지를 설치하도록 도와주는 패키지 관리자입니다. brew install을 이용해 패키지들을 쉽게 설치 할 수가 있습니다. 자세하게는 사이트에서 설치방법을 참고합니다

아래 명령어를 입력 후 맥 password를 입력하면 설치가 됩니다

 

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

 

- https://brew.sh/index_ko

 

Homebrew

The Missing Package Manager for macOS (or Linux).

brew.sh

- homebrew 참고 문서 

https://docs.brew.sh

 

Documentation

Documentation for the missing package manager for macOS.

docs.brew.sh

 

 

2. git 설치 - homebrew를 이용 

설치 명령어 

brew install git

Last login: Mon Aug 30 18:06:17 on ttys002
➜  ~ brew install git


==> Downloading https://ghcr.io/v2/homebrew/core/gettext/manifests/0.21
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gettext/blobs/sha256:cdea54f52b
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/manifests/10.37_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pcre2/blobs/sha256:0e40c8534a5f
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.33.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:4aaced15f34f02
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sh
######################################################################## 100.0%
==> Installing dependencies for git: gettext and pcre2
==> Installing git dependency: gettext
==> Pouring gettext--0.21.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/gettext/0.21: 1,953 files, 19.0MB
==> Installing git dependency: pcre2
==> Pouring pcre2--10.37_1.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/pcre2/10.37_1: 230 files, 6.2MB
==> Installing git
==> Pouring git--2.33.0.catalina.bottle.tar.gz
^[==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.33.0: 1,508 files, 42MB
==> Caveats
==> git
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git

설치 확인 명령어 

  ~ git --version

git version 2.33.0

 

 

 

3. git config 설정

config에 계정정보를 설정한다. git push시에 로그인 정보를 생략 가능하다.

 

git config -- global user.name "JeeyunHwang"
git config -- global user.email "gyoonh900@gmail.com"

 

config 확인은 아래 명령어로 가능

git config --list

 

4. ssh 설정 

 4-1) 본인의 계정을 SSH 공개 키로 인증을 해야합니다. 기존에 존재했다면 확인하는 방법

cat ~/.ssh/id_rsa.pub

4-2) 그런 파일이 존재하지 않는다면 공개키를 만들어 줍니다.

ssh-keygen

 4-2의 명령어로 공개키를 확인 하고 ssh-rsa 글자부터 복사해 둡니다. 

 

 

5. github에 SSH 키 등록하기

4-2에서 복사한 SSH키를 github에 등록 해야합니다.

github 사이트의 settings> SSH and GPG keys 에 들어가서

[New SSH Key]를 누르고 복사한 키를 붙여넣어 줍니다.

 

여기까지 등록하면 github 사용 가능합니다 

'IT > GIT' 카테고리의 다른 글

[GIT] GIT branch명 변경  (0) 2023.08.14
[GIT] webhook테스트를 위한 빈커밋  (0) 2023.07.03
[GIT] MacOS에서 Git 사용하기  (0) 2021.08.31
[GIT] 자주 사용하는 GIT 명령 기록 - 작성중  (0) 2021.04.23