반응형

git 사용시 파일을 등록(add) 하고 커밋(commit) 후 푸쉬(push) 하는 과정은 명령어가 익숙하지 않은 상태에서는 어려울 수 있습니다.

윈도우 환경에서 tortoise 도구는 명령 방식대신 GUI 프로그램을 활용하게 하여 git 사용에 도움을 받을 수 있습니다.
이 tortoise 프로그램과 커맨드 방식을 조합해서 조금 쉽게 깃허브를 사용하는 방법을 구성해 봅니다.

(PC에 git과 tortoisegit이 설치된 상태를 전제로 합니다.)
1. 깃허브에서 저장소를 생성
깃허브 헬프 페이지를 참고해서 init 수행
2. 로컬 컴퓨터에 폴더를 생성
3. 깃허브 관리페이지를 참고 SSH keys 생성 및 등록
4. 로컬 컴퓨터에 생성한 폴더에서 Git Bash Here 실행 후 생성한 SSH key 등록 
깃허브 헬프 페이지를 참고(링크)
5. 소스 파일 작업 후 tortoisegit 을 이용해 파일 등록 및 커밋 수행.
또는 커맨드 명령을 이용:
깃허브 헬프 페이지를 참고(링크)
6. Git Bash Here 에서 git push 수행

$ git push origin your-branch

 

반응형
반응형

< trouble shooting & note >
- Push  해서 오류 나는 것들은 오류 메시지에 따라 오류 fix 합니다.
- 기본적으로 ignore 리스트는 정리를 해두고 수행하는 게 좋습니다. Ignore도 add해서 활용 하는 것 확인이 필요합니다.
windows git insufficient permission for adding
서버 저장소 권한 설정을 바꾸거나 C드라이브가 아닌 다른 드라이브로 변경 설정 합니다.
- tortoise git 사용시 git clone 후 "git clone  SSL certificate problem: self signed certificate in certificate chain" 오류가 발생할 경우 Tortoise git 셋팅 에서 git 카테고리 'Edit systemwide gitconfig' 에서 [http] 탭에 sslVerify = false 를 추가 후 실행.
다른 PC에서 git repository 셋팅 PC  push가 안될 때, 확인 사항
Bitvise SSH Server 설정 확인

- 다른 PC에서 git repository 셋팅 PC 에 push가 아래와 같은 메시지로 되지 않을 때, 
remote: error: insufficient permission for adding an object to repository database ./objects 
remote: fatal: failed to write object 
error: unpack failed: unpack-objects abnormal exit 

아래와 같이 공유 폴더 권한 설정을 한다.

 - git push 후 아래 에러 메시지를 확인 합니다. 
~ ~ ~ ~ ~ 
fatal: 'origin' does not appear to be a git repository 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights 
and the repository exists. 
~ ~ ~ ~ ~ 
원격지의 git 서버 폴더 권한 문제로 발생 합니다. 
해당 폴더의 권한을 모두 허용으로 바꿔주고, '읽기 전용'을 해제 적용 합니다. 
git push를 다시 시도 하여 Success를 확인 합니다.

- Git push 후 아래 에러 메시지 발생.

(Case1)

더보기

git.exe push --progress "origin" master

 

Counting objects: 7, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (7/7), 1.22 KiB | 0 bytes/s, done.

Total 7 (delta 1), reused 0 (delta 0)

remote: error: refusing to update checked out branch: refs/heads/master

remote: error: By default, updating the current branch in a non-bare repository

remote: error: is denied, because it will make the index and work tree inconsistent

remote: error: with what you pushed, and will require 'git reset --hard' to match

remote: error: the work tree to HEAD.

remote: error:

remote: error: You can set 'receive.denyCurrentBranch' configuration variable to

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into

remote: error: its current branch; however, this is not recommended unless you

remote: error: arranged to update its work tree to match what you pushed in some

remote: error: other way.

remote: error:

remote: error: To squelch this message and still keep the default behaviour, set

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

To //…

! [remote rejected] master -> master (branch is currently checked out)

error: failed to push some refs to '…'

 

git did not exit cleanly (exit code 1) (765 ms @ 2019-11-04 오후 4:43:06)

(Case2)

더보기

git.exe push --progress "origin" master

 

Counting objects: 61, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (61/61), done.

Writing objects: 100% (61/61), 1.10 MiB | 380.00 KiB/s, done.

Total 61 (delta 52), reused 0 (delta 0)

remote: error: refusing to update checked out branch: refs/heads/master

remote: error: By default, updating the current branch in a non-bare repository

remote: error: is denied, because it will make the index and work tree inconsistent

remote: error: with what you pushed, and will require 'git reset --hard' to match

remote: error: the work tree to HEAD.

remote: error:

remote: error: You can set 'receive.denyCurrentBranch' configuration variable to

remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into

remote: error: its current branch; however, this is not recommended unless you

remote: error: arranged to update its work tree to match what you pushed in some

remote: error: other way.

remote: error:

remote: error: To squelch this message and still keep the default behaviour, set

remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.

To …

! [remote rejected] master -> master (branch is currently checked out)

error: failed to push some refs to '… '

 

git did not exit cleanly (exit code 1) (4103 ms @ 2019-11-05 오전 11:36:40)

 *서버쪽에 아래와 같이 조치

git config --bool core.bare true

(아래 시도 )

git reset --hard

git init --bare

클라이언트 쪽에서 아래와 같이 체크 (체크하지 않아도 ) 다시 push 수행

Push 성공됨을 확인.

 

반응형
반응형

< 윈도우(Windows) 환경에서 소스 버전 관리 툴인 시(Git)을 설치 하는 방법 >
1. Git 다운로드
https://git-scm.com/ 에 접속해서 다운로드 페이지에서 설치파일을 다운 받습니다.
2. Git 설치
다운 받은 설치 파일(Git-2.16.2-64-bit.exe)을 실행해서 설치 합니다.
Adjusting your PATH environment 에서 Use Git from the windows Command Prompt를 선택하여 cmd 에서도 Git 명령어를 사용할 수 있도록 합니다.
3. Git 버전 확인
Git 설치가 완료되면 Git bash 또는 CMD 명령창을 열어 git --version 명령어를 입력하면 버전이 표시됩니다. 정상적으로 버전이 표시되었다면 Git 이 설치완료 됩니다.

< TortoiseGit을 이용하여 저장소(repository) 클론(clone)해서 사용하기>
※ TortoiseGit 설치 후 아래 Name, Email을 기입하고 확인을 누른다.


1. 해당 폴더 위치에서 마우스 우클릭 으로 Git Clone 선택 합니다.
2. Git clone - TortoiseGit에서 URL, Directory 확인 후 OK 선택 합니다.
3. 계정 비밀번호를 묻는 창이 뜨면, 비밀번호 입력 후 OK 선택 합니다.
*URL 형태
ssh://계정@도메인:포트번호/var/services/homes/계정/폴더1/폴더2
*Directory 형태
C:\폴더A\폴더B

< 네트워크 보안을 위해 SSH 포트 번호를 서버설정에서 변경 후 외부에서 TortoiseGit 사용하기 >
아래 화면과 같이 해당 폴더위치로 이동 후 TortoiseGit 셋팅 메뉴에서 아래와 같이 도메인과 경로 사이에 ':포트번호'를 입력해 줍니다.

ssh://계정@도메인:포트번호/경로

< 기존 repository를 다른 PC에 옮기고 새로운 클라이언트 PC에서 clone해 오는 과정 >
1. .git을 포함 하고 있는 폴더 전체를 다른 PC에 복사 합니다.
2. Tortoise Git 에서 Git Clone 실행 합니다.
3. Clone Existing Repository의 URL에 아래 경로를 입력 합니다.
\\아이피\드라이브명\경로
Clone Existing Repository의 Directory에는 아래와 같이 자동으로 경로가 들어갑니다.
드라이브명:\경로
'OK' 버튼을 누른다.

반응형

+ Recent posts