2012-09-05 2 views
0

두 원격 ('origin'은 내부 개발 용이고 'other'는 외부 계약자 용입니다)이있는 로컬 git 저장소가 있습니다. 로컬 저장소의 마스터 브랜치가 올바른 '원본'의 마스터를 추적합니다. 또한 '기타'에서 마스터를 추적하는 '외부'지점이 있습니다. 내가 지금 가지고있는 문제는 내 주인공이 '기타'의 주인에게도 밀기를 원한다는 것인데, 이것이 문제입니다. 로컬 마스터가 다른/마스터로 푸시해야한다고 지정할 수있는 방법이 있습니까?기본적으로 마스터 브랜치를 모든 리모컨으로 푸시하지 못하게 할 수 있습니까?

나는 이미 포함하도록 내 .git/config 파일을 업데이트 시도했다 :

toko:engine cmlacy$ git remote show origin 
Password: 
* remote origin 
    Fetch URL: <REPO LOCATION> 
    Push URL: <REPO LOCATION> 
    HEAD branch: master 
    Remote branches: 
    master    tracked 
    refresh-hook  tracked 
    Local branch configured for 'git pull': 
    master merges with remote master 
    Local ref configured for 'git push': 
    master pushes to master (up to date) 

사람들은 모두 올바른 :

[branch "master"] 
    remote = origin 
    merge = refs/heads/master 
[branch "external"] 
    remote = other 
    merge = refs/heads/master 
[push] 
    default = upstream 

그러나 remote show 여전히 내 주인은 모두 리모컨으로 추진하고 있음을 보여줍니다 .

toko:engine cmlacy$ git remote show other 
Password: 
* remote other 
    Fetch URL: <REPO LOCATION> 
    Push URL: <REPO LOCATION> 
    HEAD branch: master 
    Remote branch: 
    master tracked 
    Local branch configured for 'git pull': 
    external merges with remote master 
    Local ref configured for 'git push': 
    master pushes to master (local out of date) 

마지막 절이 문제입니다. '외부'는 다른/master와 병합해야하지만 master는 결코 다른/master로 밀어 넣으면 안됩니다. 일하는 일이 절대로 없을 것입니다. 밀어 곳

답변

1

.git/config[remote "other"] 섹션에서 매개 변수 push = external:master을 추가하십시오.

+0

완벽. 감사! – Curtis

0

예, exemple에 대해 지정할 수 있습니다 git help push을하는

git push <remote> <local branch name>:<remote branch name> 

은 BTW 대답을 준 것입니다.

편집 : 나는 그것을 해결 희망

http://mislav.uniqpath.com/2010/07/git-tips/하고 (물론 Configure a local branch for push to specific branch에 당신이있을보고) 당신의 push.defaulttracking에 설정 : 당신은 아마, 추적을 설정보고 싶지, 자동으로 할 일 :)

+0

감사합니다.하지만 특정 분기로 푸시한다고 지정할 수 있습니다. 내가 할 필요가 없도록 기본 동작을 변경하는 방법을 더 찾고 있습니다. – Curtis

+0

내가 본 두 번째 링크 - 이것이 push.default를 업스트림으로 설정한다는 아이디어를 얻은 곳입니다 ("tracking"은 1.7에서 사용되지 않음). 그리고 나는 모든 추적을 설정했지만, 내 master branch가 master를 "untrack"하여 다른 "repo"에 넣을 수는없는 것 같습니다. 내 'git remote show'결과를 보여주기 위해 제 질문을 수정했습니다. – Curtis

관련 문제