'git'에 해당되는 글 2건

  1. 2021.08.20 Git repository와 로컬 폴더 연결
  2. 2021.03.19 Git 사용하기

Git repository와 로컬 폴더 연결

Git 2021. 8. 20. 03:18

Git push가 안되는 경우 (fatal: refusing to merge unrelated histories)

로컬 저장소에 있는 프로젝트를 깃허브 사이트를 통해 만든 저장소로 push 하는 경우에 이런 메세지가 뜨는 경우가 있다.

 

1
2
3
4
5
6
7
8
C:\Users\gitProject>git push origin master
To https://github.com/userId/userProject.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/userId/userProject.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
cs

 

 

push 전에 먼저 pull을 해서 프로젝트를 병합해 주어야 한다. 

 

1  refusing to merge unrelated histories cs

 

pull 명령 실행시 이런 문구와 함께 진행되지 않는다면, 다음의 명령으로 실행한다.

 

1 git pull origin 브런치명 --allow-unrelated-histories cs

 

--allow-unrelated-histories   이 명령 옵션은 이미 존재하는 두 프로젝트의 기록(history)을 저장하는 드문 상황에 사용된다고 한다. 즉, git에서는 서로 관련 기록이 없는 이질적인 두 프로젝트를 병합할 때 기본적으로 거부하는데, 이것을 허용해 주는 것이다.

:

Git 사용하기

웹 개발/Study 2021. 3. 19. 18:45

git remote add pair <Repo URL for pairs fork>

git remote -v

페어의 레버지토리 연결

 

git add<change file>

git commit -m “memo”

git push origin master ( or other branch name)

push는 자신의 레포지토리에다가 해야함

 

git pull pair master ( or other branch name)

pull은 항상 페어의 레포지토리에서 해야함

페어의 레포지토리에서 변경사항 가져오기

 

git add <change file>

git commit -m “change”

 

git pull pair master

 

 

git config credential.helper store

인증을 캐시에 저장하여 일정시간동안 입력하지 않는다.

 

git config –global credential.hgelper ‘cache –timeout 7200’

timeout뒤의 숫자는 초(second)이다. 여기서는 7200만큼(2시간)의 만료시간을 추가했다.

1day – 86400

7days – 604800

30days – 2592000

 

git checkout

branch 이동

 

git checkout -b 기능1

현재 작업공간을 베이스로 브랜치 생성

기능1 branch 생성 + 기능1 branch로 작업공간 이동

 

git branch

branch확인, q로 나가기

 

'웹 개발 > Study' 카테고리의 다른 글

객체 지향 설계의 다섯가지 원칙  (0) 2021.03.21
var let const  (0) 2021.03.21
Node 명령어  (0) 2021.03.19
HTTP 상태 코드/ 요청 메서드  (0) 2021.03.19
Promise 정리  (0) 2021.03.19
: