Github로 소스관리하기
github를 사용하여 프로젝트를 생성하고 소스를 관리하는 방법입니다.
신규 프로젝트 추가하기
Github에 신규 리파지토리 생성 (Github 문서 참조) :
Github 신규 리파지토리 생성합니다. (Github 공식 문서 참조)
해당 작업 프로젝트 폴더를 로컬 프로젝트로 초기화합니다.
$ git init
새 로컬 저장소에 파일을 추가합니다.
$ git add . # Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
로컬 저장소에 첫번째 커밋을 진합니다.
$ git commit -m "First commit" # Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
GitHub 저장소의 빠른 설정 페이지 상단에서 클릭 하여 원격 저장소 URL을 복사합니다.
터미널에서 로컬 저장소가 푸시 될 원격 저장소의 URL을 추가하십시오 .
$ git branch -M main $ git remote add origin #remote repository URL# # Sets the new remote $ git remote -v # Verifies the new remote URL
최신 소스 가져오기(Pull)
Remote 저장소의 최신 소스를 가져옵니다.
$ git pull

소스 반영하기(Github Commit & Push)
수정된 소스를 Commit 합니다. :
소스 제어탭으로 이동합니다.
수정 내용을 입력 후 Commit 합니다.

원격 서버에 수정된 사항은 push하여 반영합니다.:
$ git push -u origin main
Last updated
Was this helpful?