양쪽 이전 판
이전 판
다음 판
|
이전 판
|
wiki:eclipse:git연동 [2021/09/06 17:52] hylee |
wiki:eclipse:git연동 [2023/01/13 18:44] (현재) |
| ====== Git 연동 ====== |
====== git 연동 ====== | |
<WRAP left notice 80%> | <WRAP left notice 80%> |
* description : Eclipse에서 git 연동하는 방법 | * description : Eclipse에서 git 연동하는 방법 |
<WRAP clear></WRAP> | <WRAP clear></WRAP> |
| |
| ===== Eclipse에서 Gitlab으로 프로젝트 올리기 ===== |
| |
===== eclipse에서 git으로 올리기 ===== | ==== 1. Gitlab에 프로젝트 생성 ==== |
==== 1. GitLab에 프로젝트 생성 ==== | |
\\ | \\ |
{{:wiki:eclipse:gitlab:gitlab_01.png?400|}} | {{:wiki:eclipse:gitlab:gitlab_01.png?600|}} |
\\ | \\ |
* 이클립스에서 git Pull을 하였을 경우에 master branch와 버전이 다르거나 수정하였을 때 오류가 나는 경우가 있는데, \\ | * 우축 상단에 ''new project'' 클릭 |
* 이때 변경한 사항을 초기화 하고 master branch로 Pull 하는 경우에 쓰인다.\\ | |
{{:wiki:eclipse:gitforce:01.png?400|}}\\ | |
\\ | \\ |
| {{:wiki:eclipse:gitlab:gitlab_02.png?600|}} |
\\ | \\ |
===== 조치 ===== | * 첫번째 ''Create blank project'' 클릭 |
1. 상단 메뉴에서, Window > Show View> Other 클릭\\ | |
\\ | \\ |
2. 'type filter text'란에 'Git Repositories'를 입력 및 'Open' 버튼 클릭\\ | {{:wiki:eclipse:gitlab:gitlab_03.png?600|}} |
\\ | \\ |
3. 하단에 생성된 'Git Repositories' 창에서 Git Respositories > 프로젝트명 > Branches > Local > master 에서 마우스 오른쪽 'reset' 클릭\\ | * ''Project name'' 작성 후 하위에 ''Create project'' 클릭 |
{{:wiki:eclipse:gitforce:02.png?400|}}\\ | >> 협업이 필요할 경우 Members에 사용자를 추가해야 됨(Maintainer이상 권한) |
| |
| ==== 2. Eclipse에서 GitLab 연동 ==== |
\\ | \\ |
4. 'Reset Type'란에서 'Hard'클릭 후 'Finish' 클릭 (주의 : 수정했던 변경사항이 master branch로 초기화 됌)\\ | {{:wiki:eclipse:gitlab:01.share_project.png?600|}} |
{{:wiki:eclipse:gitforce:03.png?400|}}\\ | |
\\ | \\ |
5. 왼쪽 프로젝트명에서 마우스 오른쪽 누르고 'Pull' 선택\\ | * GitLab에 공유하고 싶은 프로젝트 우측클릭 ''Team > Share Project'' 클릭 |
\\ | \\ |
| {{:wiki:eclipse:gitlab:02.git_next.png?600|}} |
==== 커맨드 ==== | |
cd 프로젝트 디렉토리 | |
git reset --hard | |
git pull | |
\\ | \\ |
=== 주의 === | * ''Git > Next'' 클릭 |
:!: 수정했던 변경사항이 master branch로 초기화 됩니다. | \\ |
| {{:wiki:eclipse:gitlab:03.git_use_chk.png?600|}} |
| \\ |
| * 만약 이런 창이 보인다면 기존에 Git을 연동했던 프로젝트라 뜨는 것 |
| * 상단에 ''Use or create repository in parent folder of project'' 체크 해제 하면 새로 폴더를 지정할 수 있는 아래와 같은 화면이 보임 |
| * 체크 해제를 안하고 바로 ''Finish'' 를 클릭하면 현재 디렉토리에 바로 .git이 생성됨 |
| \\ |
| {{:wiki:eclipse:gitlab:03.git_use_chk_2.png?600|}} |
| \\ |
| * ''Create''를 클릭 |
| \\ |
| {{:wiki:eclipse:gitlab:04.git_use_chk_3.png?600|}} |
| \\ |
| {{:wiki:eclipse:gitlab:04.git_use_chk_4.png?600|}} |
| \\ |
| * .git 저장소를 새로 만든 다음 Finish를 누름 |
| \\ |
| {{:wiki:eclipse:gitlab:git_05.png?600|}} |
| \\ |
| * 위와 같이 프로젝트 우측에 ''공유한 폴더명 master''가 보이면 ''.git으로 연동''이 완료된 것 |
| \\ |
| {{:wiki:eclipse:gitlab:git_06.png?600|}} |
| \\ |
| * 연동된 프로젝트를 ''우측클릭 > Team > Commit''으로 ''.git''에게 파일을 올리는 과정을 진행함 |
| \\ |
| {{:wiki:eclipse:gitlab:git_07.png?600|}} |
| \\ |
| * ''우측클릭 > Team > Commit''을 클릭하면 ''Git Staging''화면이 보임 |
| * bash에서는 새로운 파일을 ''add'' 후 ''Commit''을 하지만 ''eGit''(이클립스에서 만든 Git Tool)에서는 GUI 답게 편의를 위해 ''Drag & Drop''이나 우측 상단에 ''+''로 add를 함 |
| * 아래 이미지 처럼 ''staged Changes''에 있어야 ''add''를 한 것과 같은 의미임 |
| \\ |
| {{:wiki:eclipse:gitlab:git_08.png?600|}} |
| \\ |
| * 올릴 파일들을 ''Staged Changes''에 올린 후 ''Commit''을 클릭하여 ''.git''에게 파일을 올림 |
| \\ |
| {{:wiki:eclipse:gitlab:git_09.png?600|}} |
| \\ |
| * Commit 후 gitlab에서 ''clone with HTTP'' URL을 복사 함 |
| \\ |
| {{:wiki:eclipse:gitlab:git_10.png?600|}} |
| \\ |
| * 복사 후 다시 ''프로젝트 > Team > Remote > Push''를 클릭하면 |
| \\ |
| {{:wiki:eclipse:gitlab:git_11.png?600|}} |
| \\ |
| * 클립보드에 있는 Git Clone Url이 자동으로 입력 됨 |
| * ''Next 클릭'' |
| \\ |
| {{:wiki:eclipse:gitlab:git_push.png?500|}} |
| \\ |
| * ''Source ref'' 는 로컬 어떤 branch 소스를 올릴 건지 |
| * ''Destination ref'' 는 remote의 어떤 branch 에게 올릴 건지 정하는 것 |
| \\ |
| {{:wiki:eclipse:gitlab:git_12.png?500|}} |
| \\ |
| * 지정했으면 ''Add Spec'' 클릭 |
| * ''Finish'' 클릭 |
| {{:wiki:eclipse:gitlab:git_13.png?500|}} |
| \\ |
| * git Lab 사이트에 올라온 것을 확인 |
| |
===== 출처 ===== | ===== git에서 eclipse로 내려 받기 ( 연동 ) ===== |
[[https://yard.tistory.com/entry/eclipse-git-overwrite-update|eclipse git 강제 overwrite update]]\\ | {{:wiki:eclipse:gitlab:git_09.png?600|}} |
\\ | \\ |
| * 연동할 git lab의 url 복사 |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_01.png?600|}} |
| \\ |
| * ''Git Repositories > 우 클릭 > clone a Git Repository'' 클릭 |
| * 만약 Git Repositories 창이 없다면 ''Window > show view''에서 찾으면 됨 |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_02.png?500|}} |
| \\ |
| * 첫번째 사진처럼 복사 후 두번째를 진행하면 자동으로 git 정보가 입력됨 |
| * ''Next 클릭'' |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_03.png?500|}} |
| \\ |
| * ''Next 클릭'' |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_04.png?500|}} |
| \\ |
| * git에 프로젝트를 받을 directory를 지정 후 ''Finish 클릭'' |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_05.png?600|}} |
| \\ |
| * 위와 같이 진행하면 ''Git Repositories''에 GitLab에서 받은 프로젝트가 보임 |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_06.png?600|}} |
| \\ |
| * ''Working tree > 우 클릭 > Import Projects'' 클릭 후 |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_07.png?500|}} |
| \\ |
| * ''(Import) Directory 지정'' 후 Finish 클릭하면 아래와 같이 Explorer에서 확인하면 완료 |
| \\ |
| {{:wiki:eclipse:gitlab:git_clone_08.png?500|}} |
| |
| ===== Tip ===== |
| |
| ===== Troubleshooting ===== |
| [[https://blog.naver.com/kimnx9006/220574853888|[Git] 이클립스에서 로컬 저장소와 원격 저장소 연결]] |
| |
| ===== Ref ===== |
| |
| {{tag>도봉산핵주먹 git eclipse_git에_올리기 주레피}} |
| |
{{tag>와프 git 강제 pull 강제pull 강제update 업데이트 강제업데이트}} | |