본문 바로가기
Git | Github

[Git] 로컬 프로젝트를 github에 push하기

by eugene9 2023. 6. 1.
// git 초기화: 현재 디렉토리에서 git을 정의
git init

// 프로젝트 파일 전부를 commit에 포함
git add .

// 현재 대상화된 branch와 committed된 파일 목록 보기
git status

// commit에 "commit" 메시지 남기기
git commit -m "commit"

// commit을 시도하는 사용자 정보 정의
git config --global user.email "youremail@email.com"
git config --global user.name "yourname"

// 사용자의 repository 주소 정의
git remote add origin https://github.com/yourname/repositoryname.git

// commit 정보를 repository로 push
git push origin main(혹은 master)

 

repository 파일을 반대로 받아오는 경우

git pull --rebase origin main(혹은 master)

 

그 외의 명령어

// 현재 git 설정 값(이메일, 사용자명, URL) 확인
git remote -v

'Git | Github' 카테고리의 다른 글

[Git] could not delete references: cannot lock ref ...  (0) 2024.08.26