Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

TFS에서 gitlab/github등의 git 서버로 마이그레이션하는 방법

Version Control 시스템으로 TFS를 사용하다가 git으로, 가령 github, gitlab 또는 직접 설치한 git 서버로 마이그레이션하고 싶을 수 있습니다. 아래는 그런 경우를 위한 문서입니다.

Migrating from TFS
; https://docs.gitlab.com/ee/user/project/import/tfs.html

git-tfs/git-tfs
; https://github.com/git-tfs/git-tfs

Migrate toward external git repository
; https://github.com/git-tfs/git-tfs/blob/master/doc/usecases/migrate_tfs_to_git.md

생각보다 매우 쉽게 마이그레이션할 수 있습니다. 우선, 모든 작업을 한방에 해결해주는 git-tfs 도구를 다운로드하고,

git-tfs v0.30
; https://github.com/git-tfs/git-tfs/releases
; https://github.com/git-tfs/git-tfs/releases/download/v0.30/GitTfs-0.30.0.zip

압축을 푼 다음(이 글에서는 "D:\Tools\gittfs"에 풀었다고 가정), "git-tfs.exe"를 찾을 수 있도록 환경 변수 PATH에 등록해 줍니다.

set PATH=%PATH%;D:\Tools\gittfs

잘 실행이 되는지 명령행에서 간단하게 실행해 보고,

c:\temp> git tfs help

이제 TFS 서버에 등록된 프로젝트를 다음의 명령어로 그동안의 check-in 기록을 모두 포함하면서 git 포맷으로 내려받을 수 있습니다.

git tfs clone http://[TFS서버]:[포트]/tfs/[Collection이름] $/[프로젝트_경로] [로컬_폴더] --branches=auto

예)
c:\temp> git tfs clone http://localhost:8080/tfs/DefaultCollection $/MyTest/Sources .\clone --branches=auto

("$/[프로젝트]" 경로는 "Source Control Explorer"에 들어가면 "Source Location"으로 나오는 그 경로입니다.)

위와 같이 명령을 내리면 TFS 서버의 $/MyTest/Sources 경로 이하의 모든 이력과 소스 코드를 c:\temp\clone 폴더에 로컬 git repo로 구성해 줍니다. 엄밀히 말해서 마이그레이션 작업은 사실 이게 끝입니다. 이후는 로컬에 구성된 git repo를 git의 방식대로 원격에 넣거나 로컬 그대로 사용하시면 됩니다.




당연하겠지만, tfs로부터 clone하긴 했어도 기본적으로는 remote 설정이 비어 있습니다.

c:\temp\clone> git remote
c:\temp\clone> 

따라서 gitlab(또는 github) 프로젝트 측 repo를 등록하고,

c:\temp\clone> git remote add origin https://github.com/stjeong/Sample.git

모든 내용을 업로드하면 됩니다.

c:\temp\clone> git push -u origin --all
c:\temp\clone> git push -u origin --tags




git tfs clone 시 다음과 같은 오류가 발생한다면?

c:\temp> git tfs clone http://localhost:8080/tfs/DefaultCollection $/MyTest/Sources .\clone --branches=auto
Initialized empty Git repository in D:/temp/mig/clone/clone/.git/

Git-tfs requires that the user data in git config should be set. Please configure them before using git-tfs
Actual config:
 * user name: <not set>
 * user email: <not set>
For help on how to set user git config, see https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
All the logs could be found in the log file: C:\Users\SeongTae Jeong\AppData\Local\git-tfs\git-tfs_log.txt

오류 메시지 그대로 user.name, user.email을 등록한 후 사용하면 됩니다.

c:\temp> git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
credential.helper=manager
user.name=
user.email=
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
init.defaultbranch=master

c:\temp> git config --global --list
user.name=
user.email=
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
init.defaultbranch=master

c:\temp> git config --global user.name "testusr"
c:\temp> git config --global user.email "tusr@test.com"

/*
git config --global --unset user.name
*/

위와 같은 경우 "--global로 했기 때문에 "%USERPROFILE%\.gitconfig" 파일에 설정이 저장됩니다.




"git push" 과정에서 다음과 같은 오류가 발생한다면?

c:\temp\clone> git push -u origin --all
git: 'remote-https' is not a git command. See 'git --help'.

"git-remote-https.exe" 파일이 PATH에 없어서 그런 것입니다. Visual Studio 2019 사용자의 경우 별도의 프로그램 설치 없이 그냥 다음과 같이 경로를 등록해 주면 됩니다.

set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/13/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 16  [17]  18  19  20  21  22  23  24  25  26  27  28  29  30  ...
NoWriterDateCnt.TitleFile(s)
13196정성태12/16/20224396.NET Framework: 2078. .NET Core/5+를 위한 SGen(Microsoft.XmlSerializer.Generator) 사용법
13195정성태12/15/20224989개발 환경 구성: 655. docker - bridge 네트워크 모드에서 컨테이너 간 통신 시 --link 옵션 권장 이유
13194정성태12/14/20225013오류 유형: 833. warning C4747: Calling managed 'DllMain': Managed code may not be run under loader lock파일 다운로드1
13193정성태12/14/20225062오류 유형: 832. error C7681: two-phase name lookup is not supported for C++/CLI or C++/CX; use /Zc:twoPhase-
13192정성태12/13/20225066Linux: 55. 리눅스 - bash shell에서 실수 연산
13191정성태12/11/20225981.NET Framework: 2077. C# - 직접 만들어 보는 SynchronizationContext파일 다운로드1
13190정성태12/9/20226447.NET Framework: 2076. C# - SynchronizationContext 기본 사용법파일 다운로드1
13189정성태12/9/20227077오류 유형: 831. Visual Studio - Windows Forms 디자이너의 도구 상자에 컨트롤이 보이지 않는 문제
13188정성태12/9/20225912.NET Framework: 2075. C# - 직접 만들어 보는 TaskScheduler 실습 (SingleThreadTaskScheduler)파일 다운로드1
13187정성태12/8/20225845개발 환경 구성: 654. openssl - CA로부터 인증받은 새로운 인증서를 생성하는 방법 (2)
13186정성태12/6/20224369오류 유형: 831. The framework 'Microsoft.AspNetCore.App', version '...' was not found.
13185정성태12/6/20225356개발 환경 구성: 653. Windows 환경에서의 Hello World x64 어셈블리 예제 (NASM 버전)
13184정성태12/5/20224654개발 환경 구성: 652. ml64.exe와 link.exe x64 실행 환경 구성
13183정성태12/4/20224497오류 유형: 830. MASM + CRT 함수를 사용하는 경우 발생하는 컴파일 오류 정리
13182정성태12/4/20225206Windows: 217. Windows 환경에서의 Hello World x64 어셈블리 예제 (MASM 버전)
13181정성태12/3/20224609Linux: 54. 리눅스/WSL - hello world 어셈블리 코드 x86/x64 (nasm)
13180정성태12/2/20224838.NET Framework: 2074. C# - 스택 메모리에 대한 여유 공간 확인하는 방법파일 다운로드1
13179정성태12/2/20224258Windows: 216. Windows 11 - 22H2 업데이트 이후 Terminal 대신 cmd 창이 뜨는 경우
13178정성태12/1/20224739Windows: 215. Win32 API 금지된 함수 - IsBadXxxPtr 유의 함수들이 안전하지 않은 이유파일 다운로드1
13177정성태11/30/20225456오류 유형: 829. uwsgi 설치 시 fatal error: Python.h: No such file or directory
13176정성태11/29/20224396오류 유형: 828. gunicorn - ModuleNotFoundError: No module named 'flask'
13175정성태11/29/20225962오류 유형: 827. Python - ImportError: cannot import name 'html5lib' from 'pip._vendor'
13174정성태11/28/20224575.NET Framework: 2073. C# - VMMap처럼 스택 메모리의 reserve/guard/commit 상태 출력파일 다운로드1
13173정성태11/27/20225245.NET Framework: 2072. 닷넷 응용 프로그램의 스레드 스택 크기 변경
13172정성태11/25/20225096.NET Framework: 2071. 닷넷에서 ESP/RSP 레지스터 값을 구하는 방법파일 다운로드1
13171정성태11/25/20224680Windows: 214. 윈도우 - 스레드 스택의 "red zone"
... 16  [17]  18  19  20  21  22  23  24  25  26  27  28  29  30  ...