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)
13097정성태7/12/20225458오류 유형: 817. Golang - binary.Read: invalid type int32
13096정성태7/8/20228219.NET Framework: 2030. C# 11 - UTF-8 문자열 리터럴
13095정성태7/7/20226303Windows: 208. AD 도메인에 참여하지 않은 컴퓨터에서 Kerberos 인증을 사용하는 방법
13094정성태7/6/20225995오류 유형: 816. Golang - "short write" 오류 원인
13093정성태7/5/20226926.NET Framework: 2029. C# - HttpWebRequest로 localhost 접속 시 2초 이상 지연
13092정성태7/3/20227862.NET Framework: 2028. C# - HttpWebRequest의 POST 동작 방식파일 다운로드1
13091정성태7/3/20226681.NET Framework: 2027. C# - IPv4, IPv6를 모두 지원하는 서버 소켓 생성 방법
13090정성태6/29/20225814오류 유형: 815. PyPI에 업로드한 패키지가 반영이 안 되는 경우
13089정성태6/28/20226299개발 환경 구성: 646. HOSTS 파일 변경 시 Edge 브라우저에 반영하는 방법
13088정성태6/27/20225423개발 환경 구성: 645. "Developer Command Prompt for VS 2022" 명령행 환경의 폰트를 바꾸는 방법
13087정성태6/23/20228369스크립트: 41. 파이썬 - FastAPI / uvicorn 호스팅 환경에서 asyncio 사용하는 방법 [1]
13086정성태6/22/20227793.NET Framework: 2026. C# 11 - 문자열 보간 개선 2가지파일 다운로드1
13085정성태6/22/20227858.NET Framework: 2025. C# 11 - 원시 문자열 리터럴(raw string literals)파일 다운로드1
13084정성태6/21/20226470개발 환경 구성: 644. Windows - 파이썬 2.7을 msi 설치 없이 구성하는 방법
13083정성태6/20/20227049.NET Framework: 2024. .NET 7에 도입된 GC의 메모리 해제에 대한 segment와 region의 차이점 [2]
13082정성태6/19/20226109.NET Framework: 2023. C# - Process의 I/O 사용량을 보여주는 GetProcessIoCounters Win32 API파일 다운로드1
13081정성태6/17/20226186.NET Framework: 2022. C# - .NET 7 Preview 5 신규 기능 - System.IO.Stream ReadExactly / ReadAtLeast파일 다운로드1
13080정성태6/17/20226798개발 환경 구성: 643. Visual Studio 2022 17.2 버전에서 C# 11 또는 .NET 7.0 preview 적용
13079정성태6/17/20224549오류 유형: 814. 파이썬 - Error: The file/path provided (...) does not appear to exist
13078정성태6/16/20226564.NET Framework: 2021. WPF - UI Thread와 Render Thread파일 다운로드1
13077정성태6/15/20226896스크립트: 40. 파이썬 - PostgreSQL 환경 구성
13075정성태6/15/20225857Linux: 50. Linux - apt와 apt-get의 차이 [2]
13074정성태6/13/20226157.NET Framework: 2020. C# - NTFS 파일에 사용자 정의 속성값 추가하는 방법파일 다운로드1
13073정성태6/12/20226350Windows: 207. Windows Server 2022에 도입된 WSL 2
13072정성태6/10/20226653Linux: 49. Linux - ls 명령어로 출력되는 디렉터리 색상 변경 방법
13071정성태6/9/20227229스크립트: 39. Python에서 cx_Oracle 환경 구성
... 16  17  18  19  20  [21]  22  23  24  25  26  27  28  29  30  ...