본문 바로가기
Programming/Git

[Git] Connect to Github

by skyrun 2022. 10. 9.

1. Connect Local - Github Repository by HTTP

###Do it at a local repository###

$ git remote add "remoteRepositoryName" "httpAddressAtGithub" : Since "httpAddressAtGithub" is too long, manage it by "repositoryName". (origin is the norm)

$ git remote -v : Check wheter remote is connected.

 

$ git push -u origin(rmoteRepositoryName) master(master branch of Remote Repository) : Push your commit to remote ropository. Add "-u" only for the first time.

 

It will require to login.

Username for 'https://github.com': "yourUserName" of Github

###Important Part Here###

Password for 'https://yourusername@github.com': Copy and Paste "Settings => Developer Settings => Personal acess token => Generate new token "

$ git push : Push Local to Remote. If Local Branch is committed to Remote for once

$ git pul origin(rmoteRepositoryName) master(master branch of Remote Repository) 

 

2. Connect Local - Github Repository by SSH

 

$ ssh-keygen : id_rsa, id_rsa.pub are created

- Copy id_rsa.pub content (cat id_rsa.pub) and paste at "Github => Settings => SSH and GPG Keys => New SSH Key"

- Create a repository at Github => Copy its SSH => Paste it at below

$ git remote add "remoteRepositoryName" "sshAddress"

 

'Programming > Git' 카테고리의 다른 글

[Git] Git Remote 변경하기  (0) 2022.10.17
[Git] Branch Command  (0) 2022.10.08
[Git] Git Tips  (2) 2022.10.08
[Git] Git Version Command  (0) 2022.10.08
[Git] Linux Command  (0) 2022.10.08

댓글