일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- ㅒ
- iterator
- 티스토리 쿠키 삭제
- 처음 만나는 AI 수학 with Python
- 자료구조와 함께 배우는 알고리즘 입문
- GIT
- 리눅스
- 네트워크 설정
- 이터레이터
- network configuration
- 스프링부트핵심가이드
- 스프링 시큐리티
- 코드로배우는스프링웹프로젝트
- 처음 만나는 AI수학 with Python
- d
- 서버설정
- 알파회계
- Kernighan의 C언어 프로그래밍
- 자료구조와함께배우는알고리즘입문
- resttemplate
- 친절한SQL튜닝
- 선형대수
- 코드로배우는스프링부트웹프로젝트
- 자바편
- /etc/network/interfaces
- 목록처리
- 페이징
- 데비안
- baeldung
- 구멍가게코딩단
- Today
- Total
bright jazz music
blog14 : Github SSH 설정, 프로젝트 올리기 본문
1. SSH를 사용한 통신 환경 설정
1-1 github 로그인
https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh
참고해서
setting에 추가한다.
1-2 ssh-key 생성
c/Users/user/.ssh/id_rsa 밑에 파일 생성됨.
id_rsa : 개인키 파일
id_rsa.pub : 공개키 파일
개인키 파일은 외부에 절대 공개해서는 안 된다.
개인키 파일의 내부는 아래와 같이 되어 있다. ***로 내용을 바꾸었다.
-----BEGIN OPENSSH PRIVATE KEY-----
b3B*****************************************************
b3B*****************************************************
b3B*****************************************************
b3B*****************************************************
b3B*****************************************************
...
b3B*****************************************************
6qaEHhUSTlUkBXMUWcA/VxF+veLvd3lngbwJtsWjbRc4BHFluRRNBW1n
mTTQxAQIDBAUGb3B**************************
-----END OPENSSH PRIVATE KEY-----
공개키 파일은 아래와 같이 되어 있다.
ssh-rsa AAAAB3NzaC1yc2 ... qLLVm0KtI4DHFad9Tsqcuq3jU= user@DESKTOP-Q7HBM41
1-3 깃허브 세팅에서 SSH Key 추가
공캐키의 값을 클립보드(메모리)에 복사해 준다.
| pbcopy 사용
cat ./id_rsa.pub | pbcopy
윈도우 환경에서는
| clip 명령어를 사용한다.
cat ./id_rsa.pub | clip
이렇게 되면, 이 컴퓨터가 개인키(여기서는 c:user/user/.ssh/에 존재하는 id_rsa)를 이용해서 해당 계정의 Repository에 접근할 수 있게 된다. 통신할 준비가 된 것이다.
2. Repository 만들기
3. README.md 푸시하기
echo "# blog" >> README.md //해당 디렉토리에 README.md 파일 생성
git init //해당 디렉토리에 .git 디렉토리 생성
git add README.md //스테이지에 올리기
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/h~~~~~7/blog.git
git push -u origin main
- 처음 README.md 의 내용은 #blog 뿐이다.
- .git 디렉토리의 config파일에는 설정한 리모트 레포지토리 경로가 나와있다. 설정에 문제가 있을 경우 참고해 볼 수 있다.
그래도 git log를 쳐보면 바뀌지 않는다. 그 다음 커밋부터 바뀌기 때문이다.
첫 번째 커밋을 되돌리면 된다. 어떻게 해야할까?
$ git update-ref -d HEAD
4. .gitignore 설정하고 푸시하기
https://github.com/spring-projects/spring-boot/blob/main/.gitignore#L4
*#
*.iml
*.ipr
*.iws
*.jar
*.sw?
*~
.#*
.*.md.html
.DS_Store
.attach_pid*
.classpath
.factorypath
.gradle
.idea
.metadata
.project
.recommenders
.settings
.springBeans
.vscode
/code
MANIFEST.MF
_site/
activemq-data
bin
build
!/**/src/**/bin
!/**/src/**/build
build.log
dependency-reduced-pom.xml
dump.rdb
interpolated*.xml
lib/
manifest.yml
out
overridedb.*
target
.flattened-pom.xml
secrets.yml
.gradletasknamecache
.sts4-cache
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
그러면 해당 디렉토리에서 .gitignore의 내용에 저촉되는 것들은 전부 commit 가능 파일에서 제외된다.
이제 코드를 올린다.
5. 만약 다른 pc에서 클론하려는 경우
ssh로 키를 만들고, 공개키를 깃허브 세팅에 넣어준다.
그리고
$ git clone git@github.com:h~~7/blog.git
해주면 된다.
'Projects > blog' 카테고리의 다른 글
blog15 : Git 자주 쓰는 명령어 예제 2 (0) | 2023.01.30 |
---|---|
blog15 : Git 자주 쓰는 명령어 예제 1 (0) | 2023.01.29 |
blog13: Spring REST Docs3 - 커스터마이징 (0) | 2023.01.29 |
blog13: Spring REST Docs2 - 요청, 응답필드 (0) | 2023.01.16 |
blog13: Spring REST Docs 1 -기본설정 (0) | 2023.01.15 |