Git & Github 초기설정하기

DaramGee·2023년 12월 11일
0

Git & GitHub

목록 보기
2/4

깃 초기설정하기

https://wansook0316.github.io/dv/concept/2021/07/19/Git-Tutorial.html

  • 깃, 커맨더 설치하기
  • git bash에서 환경설정하기
유저이름 설정 
git config --global user.name "your_name"

이메일 설정
git config --global user.email "your_email"

정보확인하기
git config --list
  • 코드 업로드/다운로드 하기 과정
-------------------------------------------------------------------------------------
git init            //해당 로컬폴더를 연동하기 위해 초기화하기 -> .git 숨김폴더 만들어짐
git remote add origin 깃허브 레퍼지토리 주소     //해당 레퍼지토리와 연결
git remote -v       //연결내용 확인
-------------------------------------------------------------------------------------
git status                       //폴더의 상태 확인(삭제, 추가파일 등)
git add .                        //모든 파일 더하기
git commit -m "커밋할 때 메시지"  //히스토리 만들기
git push origin master 또는 main  //깃허브에 올리기
-------------------------------------------------------------------------------------
git pull origin master 또는 main  //깃허브에서 가져오기

  • 깃 설정정보 VS로 열어서 저장하기
git code .
[core]
	editor = code
	autocrlf = true
  editor = code --wait

[user]
	name = 
	email = @gmail.com

[pull]
    rebase = false
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = code --wait --diff $LOCAL $REMOTE
[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait $MERGED
[alias]
    st = status
	hist = log --graph --all --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(white)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --date=short
[mergetool]
	keepBackup = false

설정 정보 텍스트에디터로 열기

git config -e
git config --global -e
[core]
	editor = code
	autocrlf = true
  editor = code --wait

[user]
	name = 
	email = 
[pull]
    rebase = false
[diff]
    tool = vscode
[difftool "vscode"]
    cmd = code --wait --diff $LOCAL $REMOTE
[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait $MERGED
[alias]
    st = status
	hist = log --graph --all --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(white)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --date=short
[mergetool]
	keepBackup = false

[remote "origin"]
url = 
fetch = +refs/heads/*:refs/remotes/origin/*

깃허브 팀프로젝트 시작방법

깃허브(GitHub) 프로젝트에서 팀원들과 함께 작업하는 방법은 다음과 같은 일반적인 절차를 따릅니다:

(https://prod-files-secure.s3.us-west-2.amazonaws.com/b4e7e3a4-c65f-4f5c-8e52-8340f150b1dd/b6c2960d-202c-44b8-beb1-3cbc2d4ff20b/Untitled.png)

(https://dhgu-dev.medium.com/%EB%A7%A8%EB%95%85%EC%97%90%EC%84%9C-%EC%8B%9C%EC%9E%91%ED%95%98%EB%8A%94-%ED%98%91%EC%97%85%EC%9D%84-%EC%9C%84%ED%95%9C-github-%EC%82%AC%EC%9A%A9%EB%B2%95-46f64418cf81)

깃 연결과정

  1. Git 설치: 먼저, 로컬 컴퓨터에 Git을 설치해야 합니다. Git의 공식 웹사이트(https://git-scm.com/)에서 다운로드하여 설치할 수 있습니다.
  2. 새로운 Git 저장소 생성: GitHub 웹사이트에서 새로운 저장소(repository)를 생성합니다. "New repository" 버튼을 클릭하고 저장소 이름, 설명 등을 입력한 후 "Create repository"를 선택합니다.
  3. 로컬에서 Git 초기화: 로컬 프로젝트 폴더에서 터미널 또는 명령 프롬프트를 열고 git init 명령어를 실행하여 해당 폴더를 Git 저장소로 초기화합니다.
  4. 원격 저장소와 연결: git remote add origin <GitHub 저장소 URL> 명령어를 사용하여 로컬 저장소와 원격(GitHub) 저장소를 연결합니다.
  5. 파일 추가 및 커밋: 프로젝트 폴더에 있는 파일들을 git add <파일 이름> 명령어로 스테이징(staging) 영역으로 추가한 후, git commit -m "<커밋 메시지>" 명령어로 커밋(commit)합니다.
  6. 변경 사항 push하기: git push origin <브랜치 이름> 명령어를 사용하여 변경 사항을 원격(GitHub) 저장소에 push합니다.
  7. 변경 사항 pull하기: 다른 기기나 다른 개발자가 수정한 내용을 가져오기 위해 git pull origin <브랜치 이름> 명령어를 사용하여 원격(GitHub) 저장소의 최신 변경 사항을 가져옵니다.

위의 단계들은 기본적인 Git 작업 흐름입니다. 필요에 따라 branch(브랜치), merge(병합), pull request(풀 리퀘스트) 등의 기능도 활용할 수 있습니다.

0개의 댓글