


git init을 하면 해당 폴더가 워킹 레퍼지토리가 됨.




Git에 존재하는 파일 확인
git status
Working Directory 에서 변경된 파일을 Index (stage)에 추가
git add 파일명.확장자
Index (stage) 에 추가된 변경사항을 HEAD 에 반영 (확정)



보안상의 이유로 Remote Repository 접속 시 비밀번호 대신 Token 을 사용

사용자 메뉴에서 Settings 선택 -> Developer settings 선택 -> Personal access tokens 선택 -> Generate new token 선택 -> Token 이름 입력 + No expiration 을 선택 + repo 선택 > Generate token 버튼 선택


Local Repository 에 연동할 Remote Repository 를 등록 (Token 사용)


Local Repository 에 Remote Repository 등록
- Remote Repository 등록(이렇게 하면 아이디와 비번을 remote와 연동 할 때 마다 입력해줘야함.)
 git remote add origin https://github.com/<repository>.git
- Remote Repository 등록 with Username and Token(이렇게 하면 매번 입력하지 않아도 됨.)
 git remote add origin https://<username>:<token>@github.com/<repository>.git
Remote Repository 정보 확인
git remote -v
Local Repository (HEAD) 에 반영된 변경내용을 Remote Repository 에도 반영하기 위해서는 Git Push 를 사용
commit으로 버전을 매기고 다 완료한 작업을 다른 사람들이 다 볼 수 있도록 push 하는 것임.
Git push
git push origin <branchname>

만약 master가 에러가 나면 main으로 하면 됨.

Remote Repository 의 내용에 맞춰 Local Repository 를 갱신하려면 Git Pull 사용
git pull을 해야 원격 저장소에 있는 정보를 로컬로 가져와 동기화 할 수 있음!!! 그 다음에 git add, git commit, git push 작업을 해야함.
Git pull
git pull origin <branchname>






파일을 만들 때 특정 텍스트도 같이 포함해서 만들려면
cat > 파일명 (엔터)
원하는 텍스트 (엔터)
ctrl + d
