깃과 소스트리 설치 및 환경 설정

깃 설치

  • https://git-scm.com/downloads

소스트리 설치

  • https://www.sourcetreeapp.com/

첫번째 깃 실행

  • 설치가 되면 원하는 경로에서 git 명령어를 통해 작업이 가능하다.

환경 설정

config 명령어

해당 명령을 실행하면, 새로운 config 파일을 생성

# 환경설정
git config
# 설정 지우기
git config --unset {email}

로컬 사용자

협업 과정에서 사용자를 구분하기 위해 사용자 등록 하는 과정을 거친다. (영어만 사용)

# 저장소 별 사용자 계정 설정
cd {folder}
git config user.name "{name}"
git config user.email "{email}"

글로벌 사용자(추천)

혼자서 사용한다면, 글로벌 옵션으로 사용자 지정하는 것이 편하다

# 글로벌 사용자(전역) 설정
git config --global user.name "{name}"
git config --global user.email "{email}"

환경 설정 파일 확인 및 직접 수정

깃 저장소 안에 .git/config 파일 형태로 저장됨.

mkdir git-study
cd git-study

git init
git config user.name "Chiptune93"
git config user.email "eoen012@gmail.com"

ls .git
HEAD		description	info		refs
config		hooks		objects

.git/config 경로는 로컬 저장소에서 사용자 등록을 할 때만 찾을 수 있음.

글로벌 사용자 등록을 했다면 존재하지 않는다. 대신, 개인 계정 루트에 파일을 생성한다.

ls ~/.gitconfig 

# 환경설정 파일을 찾았다면 에디터 명령으로 볼 수 있다.
cat .git/config
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
[user]
	name = Chiptune93
	email = eoen012@gmail.com

직접 파일을 열어 수정 할 수 있지만, 오류 때문에 config 명령어를 사용하여 수정하는 것을 권장.

소스트리 환경설정

도구 > 옵션 메뉴에서 설정할 수 있다.

별칭

복잡한 깃 명령을 별칭을 이용해 사용한다.

log --graph --pretty=online > show-graph

git config -global alias.show-graph 'log --graph --pretty=online'

비주얼 스튜디오 코드

VS Code를 설치 했다면, 아래의 명령으로 파일을 실행할 수 있다.

code '파일이름'

© 2024. Chiptune93 All rights reserved.