GitHub
초보를 위한 책 : https://git-scm.com/book/ko/v2
얄코 상: https://youtu.be/FXDjmsiv8fI 하 https://youtu.be/GaKjTjwcKQo
인증토큰 (2020.07)
이제부터 인증은 Token으로
권한지정후 Token생성, 생성후 권한변경 가능

<Clone> > [ add > commit > push ]

<brankch>:가상의 작업공간 와 <checkout> :코드뭉치버리기
Remote 이름은 origin
- local Brach는 main (=master)
- remote Branch 도 main (=master)
checkout : 마지막 commit으로 되돌아가기
Discard hunk, Discard changes

Merge : branch병합
https://learngitbranching.js.org/?locale=ko
현재작업하는 공간(head branch)
설치
git 명령어 -옵션
GitHub 사용
git config 명령어를 통해 설정정보를 저장할 수 있다.
GitHub은 Git(분산 버전관리툴)을 사용하는 프로젝트를 지원하는 웹호스팅 서비스
- 개인 공간으로 활용할 수 있는 유상 서비스
- 오픈소스를 위한 무상 서비스
Git으로 자신의 코드를 관리하고 있다면, GitHub에 해당 코드를 올려놓고 어디서든 수정가능하며,
다른 사람들이 내 코드에 pull-request를 보낼수도 있다.
이제 branch 이름이 master가 아닌 main으로 사용하도록 권고하고 있다.
orgin은 원격서버를 나타내고, main은 로컬의 Branch명이다.
pull-add-commit-push
암호 저장
https://amkorousagi-money.tistory.com/entry/Git-personal-access-token
GitHub Collaborator 추가하기
Push권한은 프로젝트 관리자와 Collaborator만이 가진다.
생성한 프로젝트에서 Setting > Collaborators > Add collaborator > 이메일 추가

추가된 Collaborator(협력자)는 프로젝트에 업로드(Push)/다운로드(Pull) 권한을 부여받음.
ERROR
error: Your local changes to the following files would be overwritten by merge:
commit 하거나 stash 하라
원격저장소의 내용으로 덮어 씌우는 경우가 많아서
error: The following untracked working tree files would be overwritten by merge:
로컬에서 untracked files을 clear한다.
워킹 디렉토리 안의 추적하고 있지 않은 모든 파일을 지우게 되고, 복원이 안됨
여기서, -d
(전체 디렉토리 삭제)는 아래 옵션으로 대체가능하다.
-x
: Git이 모르는 파일뿐만아니라, ignored files 까지 삭제-d
: untracked files뿐만아니라 untracked directories 까지 삭제-f
: 강제 run
인
Missing or invalid credentials. Error: socket hang up
remote: No anonymous write access. fatal: Authentication failed for

미리 github의 access tokens을 받아 저장해 둔다.

fatal: unable to access : The requested URL returned error: 403
https://beagle-dev.tistory.com/244
Pushing to https://github.com/sixxchung/adminlte.git
remote: Permission to sixxchung/adminlte.git denied to sixxchung.
fatal: unable to access ‘https://github.com/sixxchung/adminlte.git/’: The requested URL returned error: 403
Completed with errors, see above
Push할때, 해당주소에 대한 권한이 없기 때문에, 403 에러 발생
1. 인증하기
- =) git remote set-url origin “https://[email protected]/sixxchung/adminlte.git” 를 입력해주세요
- =) 여기에서 github-username 에는 본인이 github 에서 사용하는 username 을 적으시면 되고 github-repository-name 에는 git reposit 이름을 입력하시면되요. “” 큰따음표는 제거하시구요.
- =) 제일 처음에 git remote add origin git_reposit_주소.git 을 통해 origin 명칭을 만들었지만 해당 주소에 대한 권한이 없어서 푸쉬를 할 때 에러가 난거에요.
2. 소스코드 푸쉬하기
- =) 터미널에서 git push -u origin master 를 입력합니다
- =) 깃헙 패스워드 입력을 하라는 창이 나오고 입력을 하시면 본인의 깃주소에 소스코드가 올라갑니다.
- =) 인증이 끝난 후부터는 git push만 하면 기존의 세팅한 주소로 바로 푸쉬가 됩니다. 변경을 원하시면 git remote “set-url” “any_name” “git_reposit_주소”를 사용하시면 되요
100MB
please clean your repository working tree before checkout
워킹 트리 정리
다시금 pull로 땡겨오는 것
git stash
git pull