git remote명령은 프로젝트의 리모트 저장소를 관리하는 명령어입니다.

 

 

git remote

등록된 리모트 저장소 이름만 보여줍니다.

$ git remote 
origin

 

 

 

 

 

git remote -v

 

등록된 저장소 이름과 URL을 표시합니다.

$ git remote -v 
origin  https://github.com/Lks9172/toy42.git (fetch) 
origin  https://github.com/Lks9172/toy42.git (push)

 

 

 

git remote add (리모트이름) (원격저장소 주소)

 

새 리모트를 추가합니다. (경로)영역에는 URL이나 파일경로를 넣을수 있습니다.

 

$ git remote add mylotto https://github.com/Lks9172/mylotto.git 
$ git remote add origin https://github.com/Lks9172/toy42.git
$ git remote -v 
mylotto https://github.com/Lks9172/mylotto.git (fetch) 
mylotto https://github.com/Lks9172/mylotto.git (push) 
origin  https://github.com/Lks9172/toy42.git (fetch) 
origin  https://github.com/Lks9172/toy42.git (push)

 

 

 

 

git remote show (리모트이름)

 

모든 리모트 경로의 branch와 정보를 표시합니다.

 

$ git remote show origin
* remote origin
  Fetch URL: https://github.com/Lks9172/toy42.git
  Push  URL: https://github.com/Lks9172/toy42.git
  HEAD branch: master
  Remote branches:
    develop tracked
    master  tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local refs configured for 'git push':
    develop pushes to develop (up to date)
    master  pushes to master  (up to date)

 

 

 

 

 

git remote rm (리모트이름)

 

리모트 경로를 제거합니다.

 

$ git remote -v
mylotto https://github.com/Lks9172/mylotto.git (fetch) 
mylotto https://github.com/Lks9172/mylotto.git (push) 
origin  https://github.com/Lks9172/toy42.git (fetch) 
origin  https://github.com/Lks9172/toy42.git (push)

// $ git remote remove mylotto도 같은 동작을 합니다.
$ git remote rm mylotto

$ git remote -v
origin  https://github.com/Lks9172/toy42.git (fetch) 
origin  https://github.com/Lks9172/toy42.git (push)

 

 

 

 

 

 

git remote set-url (리모트이름) (원격저장소 경로)

 

해당 리모트이름의 원격저장소 경로를 변경합니다.

 

$ git remote -v
 	# View existing remotes
origin  https://github.com/Lks9172/toy42.git (fetch) 
origin  https://github.com/Lks9172/toy42.git (push)

$ git remote set-url origin https://github.com/Lks9172/mylotto.git
# Change the 'origin' remote's URL

$ git remote -v
# Verify new remote URL
origin  https://github.com/Lks9172/mylotto.git (fetch)
origin  https://github.com/Lks9172/mylotto.git (push)

 

 

 

 

 

 

 

 git remote rename (현재 리모트 이름) (바뀔 리모트 이름)

 

원격 저장소 이름 변경하기

 

$ git remote -v
# View existing remotes
origin  https://github.com/Lks9172/toy42.git (fetch) 
origin  https://github.com/Lks9172/toy42.git (push)

$ git remote rename origin destination
# Change remote name from 'origin' to 'destination'

$ git remote -v
# Verify remote's new name
destination  https://github.com/Lks9172/mylotto.git (fetch)
destination  https://github.com/Lks9172/mylotto.git (push)

 

 

 

 

 

 

 

 

 

 

참조:

sublivan.tistory.com/23?category=905894

 

minsone.github.io/git/github-managing-remotes-changing-a-remotes-url

 

minsone.github.io/git/github-managing-remotes-renaming-a-remote

 

www.delftstack.com/ko/howto/git/how-to-remove-a-git-remote-url/

반응형

'git(분산 버전 관리 시스템)' 카테고리의 다른 글

[git] git pull  (0) 2021.03.08
[git] git push  (0) 2021.03.06
[git] git commit  (0) 2021.03.06
[git] git add와 staging Area  (0) 2021.03.06
[git] 파일 상태 정리  (0) 2021.03.05

+ Recent posts