본문 바로가기

파이썬 & 장고/장고(Django)

git hub (깃허브) push , pull, ssh

$ cd ldh
:~/ldh$ git init local-repo
:~/ldh$ cd local-repo
:~/ldh/local-repo$ echo "version1" >> file1
:~/ldh/local-repo$ touch file2
:~/ldh/local-repo$ git add .

:~/ldh/local-repo$ git commit -m "add file1 file2"

:~/ldh/local-repo$ git remote add origin https://github.com/Do-du/git_test.git
:~/ldh/local-repo$ git remote -v

:~/ldh/local-repo$ git pull origin master --allow-unrelated-histories
:~/ldh/local-repo$ git push -u origin master






:~/ldh/local-repo$ touch file3
:~/ldh/local-repo$ echo "version2" >> file3
:~/ldh/local-repo$ git commit -am "version2"

:~/ldh/local-repo$ git add file3
:~/ldh/local-repo$ git commit -am "version2"

:~/ldh/local-repo$ git push origin master

 



:~/ldh/local-repo$ ls
file1 file2 file3

:~/ldh/local-repo$ git pull origin master

:~/ldh/local-repo$ ls
file1 file2 file3 remote_file_test



ssh를 이용해 로그인

:~/ldh/local-repo$ ssh-keygen

:~/ldh$ cat /home/student/.ssh/id_rsa.pub


setting -> SSH and GPG keys




:~/ldh$ cd local-repo/
:~/ldh/local-repo$ git remote set-url origin git@github.com:DO-du/git_test.git

:~/ldh/local-repo$ git remote update origin



:~/ldh/local-repo$ echo "version5" >> file5
:~/ldh/local-repo$ git add file5
:~/ldh/local-repo$ git commit -m "create file5"

:~/ldh/local-repo$ git log --branches

:~/ldh/local-repo$ git push

 





master -> main

:~/ldh/local-repo$ git checkout main
:~/ldh/local-repo$ git log

:~/ldh/local-repo$ ls
file1 file2 file3 file5 main remote_file_test
:~/ldh/local-repo$ git merge master (안됨)
:~/ldh/local-repo$ git pull origin master --allow-unrelated-histories

:~/ldh/local-repo$ git push

'파이썬 & 장고 > 장고(Django)' 카테고리의 다른 글

HTML5 기본 태그  (0) 2021.06.08
HTML5 기본 구조와 작성법  (0) 2021.06.08
git 깃 브랜치 (Branch)  (0) 2021.06.07
git 깃 변경 이력 병합(Merge)  (0) 2021.06.07
git 깃 push,clone,pull  (0) 2021.06.07