Git은 분산 버젼 관리 시스템입니다.
설치 여부는 cmd에서 해당 명령어로 확인할 수 있습니다.
git --version
1. 설치
Git
git-scm.com
2. git 저장소 만들기
git은 Working Directory, Staging area, git repository, git remote area로 구성되어있습니다.
| Working Directory | 아무것도 안한 상태 |
| Staging area | |
| git local repository | |
| git remote area |
git add.
git status
git commit -m "First init"
- .gitIgonore 파일을 만들어서 node_modules등을 제외한다. (npm install로 언제든 받을 수 있음)
- git add. 로 전체 파일을 Staging area에 올린다.
- git status로 add된 것 확인
- git commit -m "First Init"로 메시지를 남긴다.
- 만약 잘못 들어간 것은 'git rm --cached 이름 -r'로 지워준다.
git rm --cached node_modules -r
3. Git remote
Git remote area를 구성할 때는, 따로 git 서버를 구성할 수도 있고 bitbucket이나 github를 사용한다.
git은 분산 버젼 관리 시스템이고 github나 bitbucket은 깃을 사용하는 클라우드 서비스입니다.
Build software better, together
GitHub is where people build software. More than 50 million people use GitHub to discover, fork, and contribute to over 100 million projects.
github.com
https://www.atlassian.com/ko/software/bitbucket
Bitbucket | The Git solution for professional teams
Collaborate on code with inline comments and pull requests. Manage and share your Git repositories to build and ship software, as a team.
bitbucket.org
2020년 이전까지는 깃허브가 비공개 프로젝트를 지원하지 않아 비트버킷을 주로 사용했는데요, 이제는 깃허브도 비공개 프로젝트를 지원합니다.
1) 새 저장소를 만듭니다.
2) 안전한 업로드를 위해 http대신 ssh를 사용합니다.
4. git ssh
Generating a new SSH key and adding it to the ssh-agent - GitHub Help
Generating a new SSH key and adding it to the ssh-agent After you've checked for existing SSH keys, you can generate a new SSH key to use for authentication, then add it to the ssh-agent. Mac Windows Linux All If you don't already have an SSH key, you must
help.github.com
1) Generating a new SSH key
2) Open Git Bash.
cmd에서는 안 먹힐 수 있으니 git bash에서 진행
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
3) Adding your SSH key to the ssh-agent
$ eval $(ssh-agent -s)
Agent pid 1195
$ ls -a ~/.ssh
./ ../ id_rsa id_rsa.pub
$ ssh-add ~/.ssh/id_rsa
퍼블릭키와 프라이빗키를 가지고 있는 것
4) Adding a new SSH key to your GitHub account
이제 깃에서 퍼블릭키를 넣어줍니다.
help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
Adding a new SSH key to your GitHub account - GitHub Help
Adding a new SSH key to your GitHub account To configure your GitHub account to use your new (or existing) SSH key, you'll also need to add it to your GitHub account. Mac Windows Linux All Before adding a new SSH key to your GitHub account, you should have
help.github.com
이제 깃에서 퍼블릭키를 넣어주어야하는데
clip < ~/.ssh/id_rsa.pub
를 하면 퍼블릭키가 클립보드에 복사됩니다.
5) Setting
이제 깃허브로 가서 'SETTING' 누르고 'SSH and GPG KEYS'에서 새 키를 만들고
복사한한 퍼블릭 키를 붙여넣기 한다.
이제 안전하게 통신할 수 있습니다.
5. remote push
git remote add origin 깃허브 주소
git push -u origin master
'ETC' 카테고리의 다른 글
| [이클립스] 메모리 설정 (0) | 2021.01.27 |
|---|---|
| [Errors] (Vue.js) npm install 시 에러 (1) (0) | 2021.01.12 |
| [Git] 계속 github 인증 오류가 날 때 (0) | 2021.01.03 |
| [Git] ssh 관련 인증 삭제 (0) | 2021.01.03 |
| [error] npm install bcrypt --save 설치 오류 (0) | 2020.06.15 |
| [API] The MovieDB API (0) | 2020.06.15 |
| [Settings] Sublime text(서브라임 텍스트) 설치 (0) | 2020.06.15 |
| [error] 'react-scripts'은(는) 내부 또는 외부 명령, 실행할 수 있는 프로그램, 또는 (0) | 2020.06.15 |
