Github 기존 프로젝트 등록하기
-
기존 프로젝트 폴더로 이동하여 git 초기화합니다.
» cd /mnt/c/Users/webme/workspace/test » git init » ls -lah drwxrwxrwx donghyeok-dev donghyeok-dev 512 B Fri Aug 20 11:27:09 2021 .git
-
github에서 프로젝트를 생성하고 clone의 https 주소를 복사한 다음 git 디렉토리의 remote를 추가합니다.
» git remote add origin https://github.com/donghyeok-dev/test.git » git remote -v origin https://github.com/donghyeok-dev/test.git (fetch) origin https://github.com/donghyeok-dev/test.git (push)
-
git pull 하기
» git pull origin master Username for 'https://github.com': Password for 'https://donghyeok-dev@github.com': remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
2021-08-13일 부로 push, clone, pull 시 비밀번호 대신 토큰을 사용하게 변경되었기 때문에 발생하는 오류입니다.
-
토큰 생성하고 컴퓨터에 등록하기
github 설정 - Developer settings
Generate new token 클릭하고 Note, Expireation(토큰 만료일), Select scopes(권한 범위)를 지정한 다음 생성(Generate token)을 클릭합니다.
생성화면에서 키는 복사해서 보관해둡니다.
제어판에서 자격증명에서 github 관련 자격을 삭제하고 재등록합니다.
일반 자격 증명을 추가합니다. github 접속 아이디와 암호는 발급받은 토큰을입력합니다.
증명 추가 후에 git pull 명령을하면 username과 password를 입력하라고 나오는데, password에 발급받은 토큰을 입력하면 성공적으로 명령이 실행됩니다.
» git pull origin master
Username for 'https://github.com': donghyeok-dev
Password for 'https://donghyeok-dev@github.com':
From https://github.com/donghyeok-dev/test
* branch master -> FETCH_HEAD
.gitignore 파일을 작성합니다.
» vim .gitignore
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.metadata
bin/
tmp/
DATABASE/
target/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
.project
.classpath
### STS (Spring Tool Suite) ###
.springBeans
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### SVN ###
.svn/
프로젝트를 커밋하고 push한다.
» git add .
» git commit -m "Upload project"
» git push origin master
Username for 'https://github.com': donghyeok-dev
Password for 'https://donghyeok-dev@github.com':
Enumerating objects: 875, done.
Counting objects: 100% (875/875), done.
Delta compression using up to 4 threads
Compressing objects: 100% (658/658), done.
Writing objects: 100% (874/874), 5.78 MiB | 4.01 MiB/s, done.
Total 874 (delta 192), reused 874 (delta 192)
remote: Resolving deltas: 100% (192/192), done.
To https://github.com/donghyeok-dev/test.git
44022cb..a32be62 master -> master
댓글남기기