고양이 파일 😺
light@YSH MINGW64 ~/Documents/Github/Git-Test/te
$ git init // 파일안에 git 생성
Initialized empty Git repository in C:/Users/ligt1/cat/.git/
light@YSH MINGW64 ~/Documents/Github/Git-Test/te
$ git config user.name cat // name 생성
light@YSH MINGW64 ~/Documents/Github/Git-Test/te
$ git config user.email cat@git.com // email 생성
light@YSH MINGW64 ~/Documents/Github/Git-Test/te
$ vim README.md // git bash창안에서 README.md 파일 생성
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git add . // 무대 올라가기전 준비
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git commit -m c1 // 무대 올라가라!
[main (root-commit) 96e46c9] c1
1 file changed, 1 insertion(+)
create mode 100644 README.md
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ vim README.md // README.md파일에 들어가서 파일 내용 수정했었음
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git add . // 무대 올라가기전 대기 해주세요~
warning: in the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it
gi
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git commit -m c2 // 무대 올라가라!
[main adcbe46] c2
1 file changed, 1 insertion(+)
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git log --oneline --branches --graph // 역사를 좀 보고
* adcbe46 (HEAD -> main) c2
* 96e46c9 c1
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git remote add origin https://github.com/yshls/test1.git // github에서 만든 리포지터리를 내 파일에 추가하는 작업
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/cat (main)
$ git push origin main // 원격 리포지터리에 올리기
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 12 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 443 bytes | 221.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To https://github.com/yshls/test1.git
* [new branch] main -> main
문어 파일 🐙
고양이 파일에서 했던 작업을 문어파일에서도 해줍니다!
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct
$ git clone https://github.com/yshls/test1.git . // 깃 클론 작업인데 띄어쓰기 하고 점 꼭! 해주기
Cloning into '.'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 6 (delta 0), reused 6 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (6/6), done.
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (main)
$ git config user.name oct
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (main)
$ git config user.email oct@git.com
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (main)
$ ls
README.md
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (main)
$ git branch feat/member // 기능을 추가하기 위해서 branch 생성
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (main)
$ git switch feat/member
Switched to branch 'feat/member'
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ ls
README.md
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ mkdir member // bash창 통해서 member 파일 만들기
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ cd member // member 파일 안으로 들어갔다.
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct/member (feat/member)
$ vim MemberController.java // .java파일 하나 만들어주고
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct/member (feat/member)
$ cd .. // 파일 밖으로 이동!
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ git status // 상태 좀 보고
On branch feat/member
Untracked files:
(use "git add <file>..." to include in what will be committed)
member/
nothing added to commit but untracked files present (use "git add" to track)
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ git add .
warning: in the working copy of 'member/MemberController.java', LF will be replaced by CRLF the next time Git touches it
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ git status
On branch feat/member
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: member/MemberController.java
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ git commit -m o1 // 커밋하고
[feat/member 939566d] o1
1 file changed, 3 insertions(+)
create mode 100644 member/MemberController.java
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$ git log --oneline --branches --graph // 이것도 역시 역사를 좀 보고
* 939566d (HEAD -> feat/member) o1
* adcbe46 (origin/main, origin/HEAD, main) c2
* 96e46c9 c1
light@YSH MINGW64 ~/Documents/Github/Git-Test/test1/oct (feat/member)
$
근데 기존 계정으로 계속 로그인되는 오류 발생
파일 생성 3~4번 해도 계속 오류 발생!!!!
오류 해결 하기 위해 시도한 방법
1. 모든 계정 로그아웃 -> 실패
2. passkey도 삭제 -> 실패
3. 원래 git bash창에서 $ cmdkey /delete:git:https://github.com 입력 -> 성공
최종적으로 git bash 창에서
light@YSH MINGW64 ~
$ cmdkey /delete:git:https://github.com
CMDKEY: 자격 증명을 삭제했습니다.
자격 증명이 삭제되었다고 뜨면 문제가 해결된 것이다. 근데 저걸 삭제하고 난 로그인을 통해서 각각 사이트를 로그인했다.. 좋지 않은 해결방법이었다. 자격 증명을 삭제해서 로그인 창이 나타나면 깃허브에서 발급한 토큰을 통해 로그인하면 쉽게 기존 계정과 부계정을 왔다갔다 가능하다.
(시간이 부족해 짝을 정해 각각 깃허브로 접속해 위에와 같이 반복하는 과정을 했다.)
이번 Git시간에서는 충돌 발생 후 해결하는 과정이 핵심이었다.
작업하다 충돌이 발생하면 pr -> merge 하고 중복되는 과정을 수정하면 해결 된다.
뭔가를 취소하고 싶을때 3가지 방법이 있다.
1. reset -> 쓰지마
2. rebase -> 쓰지마
3. revert -> 선택 (순서가 어떠하든 간에 원하는 녀석을 지울 수 있다. 😎)
첫 대면 수업! 어쩌면 마지막일 수도?
생각보다 집중 잘되고!
재밌었고!
시간도 빠르게 갔다!
오류를 해결하는 과정에서 앞 부분을 삭제하고 여러번 반복했다.
예전에는 git bash 창에서 작업하는게 어렵게 다가왔었지만
막상 부딪치면 별거아니였다.
어려울땐 반복 또 반복하자
'💡 URECA > 🗒️ 스터디 노트' 카테고리의 다른 글
[URECA] Day 26 | SQL(2) (1) | 2025.03.04 |
---|---|
[URECA] Day25 | SQL(1), JDBC (0) | 2025.02.28 |
[URECA] Day 23 | Git (0) | 2025.02.26 |
[URECA] Day22 | 알고리즘 | 그래프 응용(백트래킹, 위상 정렬) (0) | 2025.02.25 |
[URECA] Day21 | 알고리즘 | MST 알고리즘 (1) | 2025.02.24 |