windows에서 git쓰다가 마주한 문제 해결 과정
맨날 source tree나 Github desktop 같은 GUI툴만 써서 예전에 알았던 git 명령이 기억이 나지 않아버렸다;;
새로운 프로젝트를 생성해서 원격에 만들어둔 repository에 push 하려는데, 터미널로 git을 사용하는데에 셋팅이 안되어있어서 몇가지 과정을 통해 해결했다.
1. 원격 저장소 추가
git remote add origin https://github.com/Kkosunae/backend
git add .
2. commit & push
git commit -m "Feat #1 프로젝트 생성"
git push origin master
마스터에 푸시를 했더니 위와같은 에러가 발생했다.
remote: Permission to Kkosunae/backend.git denied to ssowon.
이 블로그를 참고하여 윈도우즈에서 자격 증명 관리자를 들어가서
git:https://github.com 의 계정을 편집해줬다.
fatal: Authentication failed for 'https://github.com/Kkosunae/backend/'
찾아봤더니 이제 계정 id랑 password로는 안되고 key chain이 생겼나보다.
이번엔 이 블로그를 참고하여 깃허브에서 Personal access token을 생성했다.
깃허브 -> setting -> Developer settings -> Personalaccess tokens 에서 발급할 수 있었다.
그리고 PUSH 성공 !
3. 깃헙에서 차이점이 없다는 에러 발생
원격에서 Push는 확인이 되는데, compare하니 차이점이 없어서 pull request가 안되는 문제가 발생
There isn’t anything to compare.
main and master are entirely different commit histories.
요 블로그 참고하여 해결
git branch main master -f
git checkout main
git push origin main -f
git checkout master
이번 프로젝트에선 터미널로만 git 작업해서 git잘알이 되어야지 ....