git remote
GIT REMOTE 란
처음 git clone 를 받기 위해서는 네트워크외부 또는 내부의 저장소(git repository) 가 존재하여야한다.
현재 프로젝트를 git clone 으로 받았다고 하면 받은 내부/외부의 저장소를 우리는 GIT 에서 remote 라 한다.
이번에는 GIT remote 의 사용방법에 대해 알아보겠다.
GIT REMOTE 를 이용하여 내부/외부의 저장소를
삭제/추가/제거/수정
할수있다.
이런경우에 이용할수있다.
git clone 을 remote 로부터 진행하였으며 remote 는 test_net.com 이다.
하지만 remote 가 어떤 이유에서인지 변경되었다.
그래서 급하게 moved_test_net.com 으로 remote 를 바꿔야하는 경우가 생기게 되었다.
설명: git-transote - 추적 된 저장소 세트를 관리함
GIT-REMOTE(1) Git Manual GIT-REMOTE(1)
NAME
git-remote - Manage set of tracked repositories
SYNOPSIS
git remote [-v | --verbose]
git remote add [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=<fetch|push>] <name> <url>
git remote rename <old> <new>
git remote remove <name>
git remote set-head <name> (-a | --auto | -d | --delete | <branch>)
git remote set-branches [--add] <name> <branch>...
git remote get-url [--push] [--all] <name>
git remote set-url [--push] <name> <newurl> [<oldurl>]
git remote set-url --add [--push] <name> <newurl>
git remote set-url --delete [--push] <name> <url>
git remote [-v | --verbose] show [-n] <name>...
git remote prune [-n | --dry-run] <name>...
git remote [-v | --verbose] update [-p | --prune] [(<group> | <remote>)...]
DESCRIPTION
Manage the set of repositories ("remotes") whose branches you track.
OPTIONS
-v, --verbose
Be a little more verbose and show remote url after name. NOTE: This must be placed between remote and subcommand.
여러분의 현재 사용하고있는 git 프로젝트에 대해서
새로 생성하였거나 아니면 대부분은 git clone 으로 받아왔을것이다.
새로 생성한 경우가 아니고 프로젝트에 참여한 멤버중 하나로 git clone 으로 프로젝트를 받아왔다면
다음과 같이 git remote 정보가 존재하게된다.
git remote
origin
git remote -v
origin git@test_domain:mysw/git/git-remote/test.git (fetch)
origin git@test_domain:mysw/git/git-remote/test.git (push)
git remote 정보는
.git 폴더의 config 파일을 읽어보면 알수있다.
bm@VMI:~/prj/git-remote$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
[remote "origin"]
url = git@test_domain:mysw/git/git-remote/test.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
Description: git remote 명령으로 연결된 remote 인 origin 에 대한 정보를 얻어올수있음
remote 알아보기( remote -v )
git remote -v
martin@VMI:~/work/std/git-submodule/prj_A/sdk$ git remote -v
origin /home/martin/work/sdk (fetch)
origin /home/martin/work/sdk (push)
remote 제거
git remote remove origin
remote 추가
git remote add origin URL
추가이후
> git pull
From git@moved_test_domain:mysw/git/git-remote/test.git
* [new branch] master -> origin/master
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
> git branch --set-upstream-to=origin/master master
bm@VMI:~/prj/git-remote/test$ git branch --set-upstream-to=origin/master
Branch 'master' set up to track remote branch 'master' from 'origin'.
반응형
'GIT' 카테고리의 다른 글
GIT format-patch (0) | 2021.12.24 |
---|---|
GIT TAG (0) | 2021.12.24 |
GIT submodule (0) | 2021.12.24 |
댓글