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)
์ค์น
brew install git git-lfs
git config --global user.name "Your Name" git config --global user.email "[email protected]" git config --global core.precomposeunicode true git config --global core.quotepath false
git config -l credential.helper=osxkeychain user.name=sixx [email protected] filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true core.precomposeunicode=true core.quotepath=false
git ๋ช ๋ น์ด -์ต์
GitHub ์ฌ์ฉ
~$โ git init
git config ๋ช ๋ น์ด๋ฅผ ํตํด ์ค์ ์ ๋ณด๋ฅผ ์ ์ฅํ ์ ์๋ค.
~$โ git config --list ~$โ git config --global core.editor "code --wait" # vscode๋ก editor๋ณ๊ฒฝ ~$โ git config --global user.name "sixxchung" ~$โ git config --global user.email "์ด๋ฉ์ผ์ฃผ์" ~$โ git config --global core.autocrlf input # for mac ~$โ git config --global core.autocrlf true # for window ~$โ git config --global -e hint: Waiting for your editor to close the file...
GitHub์ Git(๋ถ์ฐ ๋ฒ์ ๊ด๋ฆฌํด)์ ์ฌ์ฉํ๋ ํ๋ก์ ํธ๋ฅผ ์ง์ํ๋ ์นํธ์คํ ์๋น์ค
- ๊ฐ์ธ ๊ณต๊ฐ์ผ๋ก ํ์ฉํ ์ ์๋ ์ ์ ์๋น์ค
- ์คํ์์ค๋ฅผ ์ํ ๋ฌด์ ์๋น์ค
Git์ผ๋ก ์์ ์ ์ฝ๋๋ฅผ ๊ด๋ฆฌํ๊ณ ์๋ค๋ฉด, GitHub์ ํด๋น ์ฝ๋๋ฅผ ์ฌ๋ ค๋๊ณ ์ด๋์๋ ์์ ๊ฐ๋ฅํ๋ฉฐ,
๋ค๋ฅธ ์ฌ๋๋ค์ด ๋ด ์ฝ๋์ pull-request๋ฅผ ๋ณด๋ผ์๋ ์๋ค.
git add * git commit -m "some init msg"
์ด์ branch ์ด๋ฆ์ด master๊ฐ ์๋ main์ผ๋ก ์ฌ์ฉํ๋๋ก ๊ถ๊ณ ํ๊ณ ์๋ค.
~$โ git branch -M main
orgin์ ์๊ฒฉ์๋ฒ๋ฅผ ๋ํ๋ด๊ณ , main์ ๋ก์ปฌ์ Branch๋ช ์ด๋ค.
git remote add origin https://github.com/sixxchung/dam.git git push -u origin main
pull-add-commit-push
/git$ git clone https://github.com/sixxchung/dam.git /git$ cd dam /git$ cd /git/dam /git/dam$ git stauts /git/dam$ git pull /git/dam$ git add . /git/dam$ git commit -m "commmmment /git/dam$ git push
root@273bd20cb55e:/workspace/git# cd edulab root@273bd20cb55e:/workspace/git/edulab# git pull Username for 'https://github.com': sixxchung Password for 'https://[email protected]': remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Compressing objects: 100% (1/1), done. remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/sixxchung/edulab f5e2bb1..376228e main -> origin/main Updating f5e2bb1..376228e Fast-forward README.md | 1 + 1 file changed, 1 insertion(+) root@273bd20cb55e:/workspace/git/edulab# git add . root@273bd20cb55e:/workspace/git/edulab# git commit -m "0604" [main 7a888f7] 0604 14 files changed, 19805 insertions(+), 1 deletion(-) create mode 100644 .ipynb_checkpoints/3-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/3-checkpoint.py create mode 100644 .ipynb_checkpoints/Untitled1-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/Untitled2-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/global_a-checkpoint.ipynb create mode 100644 .ipynb_checkpoints/global_a-checkpoint.py create mode 100644 3.ipynb create mode 100644 Untitled1.ipynb create mode 100644 Untitled2.ipynb create mode 100644 __pycache__/global_a.cpython-36.pyc create mode 100644 global_a.ipynb create mode 100644 global_a.py create mode 100644 submission_xgb1.csv root@273bd20cb55e:/workspace/git/edulab# git push Username for 'https://github.com': sixxchung Password for 'https://[email protected]': Counting objects: 15, done. Delta compression using up to 256 threads. Compressing objects: 100% (15/15), done. Writing objects: 100% (15/15), 162.79 KiB | 6.51 MiB/s, done. Total 15 (delta 4), reused 0 (delta 0) remote: Resolving deltas: 100% (4/4), completed with 1 local object. To https://github.com/sixxchung/edulab.git 376228e..7a888f7 main -> main
์ํธ ์ ์ฅ
# Pullํ๊ธฐ์ ์ ์๋ ์ฝ๋๋ฅผ ์คํ ์ํค๊ณ , git config --global credential.helper store git pull #Username #Password
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 ํ๋ผ
์๊ฒฉ์ ์ฅ์์ ๋ด์ฉ์ผ๋ก ๋ฎ์ด ์์ฐ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์์
$ git stash $ git pull
error: The following untracked working tree files would be overwritten by merge:
$ git add -A # git add . # git add * $ git stash $ git pull
๋ก์ปฌ์์ untracked files์ clearํ๋ค.
์ํน ๋๋ ํ ๋ฆฌ ์์ ์ถ์ ํ๊ณ ์์ง ์์ ๋ชจ๋ ํ์ผ์ ์ง์ฐ๊ฒ ๋๊ณ , ๋ณต์์ด ์๋จ
$ git clean -d -f .
์ฌ๊ธฐ์, -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์ ๋ฐ์ ์ ์ฅํด ๋๋ค.
~ $ vi .git-credentials https://sixxchung:[email protected]
$ git config --global credential.helper store
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