Git-Hub에 레포지토리를 만드는 방법과 연결방법

Git의 내용을 Git-Hub에 업로든 하는 방법

mrl@mrl:~$ cd git에_올리기_위한_파일 경로

//만약, 처음 git과 연동한다면 아래를 해주자
mrl@mrl:~$ git remote add origin 자신의_레포지토리_주소
mrl@mrl:~$ git init 
mrl@mrl:~$ git config --global user.email "[email protected]" //자신 이메일
mrl@mrl:~$ git config --global user.name "ryung" //자신 이름

//이후부터는 여기부터 하면 됨
mrl@mrl:~$ git add . //만약 모두 올리고 싶다면 .을 빼면 된다. .은 수정된 파일만 추가하는것
mrl@mrl:~$ git commit -m "여기에 commit 메세지 적는다"

[main e7f836e] 2023.10.6 change 2 link to 5 link
 2 files changed, 226 insertions(+), 21 deletions(-)
 create mode 100644 robot_arm.asv
//뭐 대충 이런식으로 몇개를 찾았고, 어디가 바뀌고 무슨 파일이다 라고 나오면 성공

mrl@mrl:~$ git branch -M main
mrl@mrl:~$ git push -u origin main //이걸 하면 아래 두줄이 나온다

Username for '<https://github.com>': Ryung-coding //올리는 곳 이름
Password for '<https://[email protected]>': //토큰 적으면 됨
-> 나의 토큰 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

Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 4 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 4.11 KiB | 2.06 MiB/s, done.
Total 6 (delta 0), reused 0 (delta 0)
To <https://github.com/Ryung-coding/inchworm.git>
 * [new branch]      main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'. //이러면 성공한거

Q. 토큰은 뭔데 씹덕아 어떻게 만드나요?

image.png

프로필 ⇒ 셋팅 ⇒ personal acess tokens ⇒classic으로 토큰 생성 (뭐든 권한 아래와 같이 주기)

<aside> 🔥

이떄, 토큰은 이후에 다시는 뜨지않으므로 꼭 어딘가에 잘 보관해놔야합니다!!!!!!!!!!!!!!!!!!!!!!!!

</aside>

자신, 혹은 다른 사람의 Git-Hub의 자료를 가져오는 방법

$ cd 내가 소스를 복사하고자하는 경로
$ git clone 파일주소(ex <https://github.com/Ryung-coding/inchworm>) 복사폴더 이름
	// 내 복사하고자 하는 경로상에 복사하는 파일을 inchworm_beta 라는 폴더라는 이름으로 복사를 원할때
	// git clone 파일주소(ex <https://github.com/Ryung-coding/inchworm>) inchworm_beta
Cloning into 'inchworm_beta'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 2), reused 9 (delta 1), pack-reused 0
Receiving objects: 100% (10/10), 4.96 KiB | 4.96 MiB/s, done.
Resolving deltas: 100% (2/2), done.

+a checkout & switch