git1.jpg

Git이 로컬 저장소 인데 반해,GitHub는 원격지 저장소이다.

Git을 통해 형상 관리를 할 수 있을 수 있을 뿐만 아니라,원격 저장소인 github을 통해서 이제는 개발자들이 커뮤니케이션을 통해 개발 소스를 공유할 때도 많이 쓰인다.

GitHub에 데이터 업로드 하기

1)회원 가입한다.

2)저장소를 만든다.

3)자료를 업로드 한다.

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git remote add origin <https://github.com/unisoft777/animal.git>

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git push origin master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 553 bytes | 553.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To <https://github.com/unisoft777/animal.git>
 * [new branch]      master -> mas

다른 로컬 저장소에서 다운 받기


--로컬 레포지토리 설정
kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat
$ git init
Initialized empty Git repository in C:/Users/kitt/Desktop/cat/.git/

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git config --global user.email "[email protected]"

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git config --global user.name "unisoft777"

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git add shoppinglist.txt

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git commit -m "쇼핑리스트-사이트설명"
[master (root-commit) 9292d8f] 쇼핑리스트-사이트설명
 1 file changed, 1 insertion(+)
 create mode 100644 shoppinglist.txt

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$  git add shoppinglist.txt

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$  git commit -m "쇼핑리스트2-사이트설명"
[master 4c8b857] 쇼핑리스트2-사이트설명
 1 file changed, 1 insertion(+), 1 deletion(-)

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git log
commit 4c8b85741c6df31aa8d0b4b6a2654081f131fff8 (HEAD -> master)
Author: unisoft777 <[email protected]>
Date:   Mon May 13 09:15:01 2024 +0900

    쇼핑리스트2-사이트설명

commit 9292d8f30f53d87c378b82f8dd0a8f446e8ac71d
Author: unisoft777 <[email protected]>
Date:   Mon May 13 09:13:03 2024 +0900

    쇼핑리스트-사이트설명

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git checkout 9292d8f
Note: switching to '9292d8f'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 9292d8f 쇼핑리스트-사이트설명

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat ((9292d8f...))
$ git checkout -
Previous HEAD position was 9292d8f 쇼핑리스트-사이트설명
Switched to branch 'master'

--원격지로 데이터 전송
kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git remote add origin <https://github.com/unisoft777/animal.git>

kitt@DESKTOP-FD9VVHG MINGW64 ~/Desktop/cat (master)
$ git push origin master
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 6 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 553 bytes | 553.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)
To <https://github.com/unisoft777/animal.git>
 * [new branch]      master -> master