Git 시작하기

sckim0430·2022년 8월 24일
0

Github

목록 보기
1/3
post-thumbnail

우분투 환경에서 Git을 시작하기 위한 방법을 정리하고자 한다.

1. Git 설치 및 설정

$ sudo apt-get install git

$ git config --global user.name "name"

$ git config --global user.email "email"

2. Git 시작하기

순서명령어설명
1git init로컬 Repository 생성
2git remote add origin [remote_repository_url]원격 Repository 추가
3git add [-A][local_file_path]상태 추적 파일 추가
4git commit [-m msg]상태 저장
5git push origin [branch]파일 업로드
6git clone [remote_repository_url][local_repository_url]파일 다운로드
7git pull origin [branch]변경 사항 업데이트(병합)
8git fetch origin [branch]변경 사항 업데이트(병합x)

유의 사항

현재 Github는 remote repository의 default branch가 main으로 되어있다.하지만, 터미널을 통해 git 명령어를 입력하는 경우 Local repository의 default branch가 master로 되어있으므로 다음 링크로 이동하여 default branch를 수정해줘야 한다.

또한 Terminal을 통해 Github 계정의 비밀번호로 사용될 토큰 설정이 필요하다. 다음 링크로 이동하여 개인 접근 토큰을 생성하여 Github 계정에 로그인한다.

profile
Vision AI Engineer

0개의 댓글