programing

원래 레포의 복제본에서 포크로 푸시하려면 어떻게 해야 합니까?

minimums 2023. 7. 2. 19:11
반응형

원래 레포의 복제본에서 포크로 푸시하려면 어떻게 해야 합니까?

포크를 myrepo의 )입니다orirepo) 깃허브.나중에, 나는 복제했습니다.orirepo.

git clone https://github.com/original/orirepo.git

약 20개의 파일을 수정한 다음 변경 사항을 준비하고 약속했습니다.

git add
git commit

하지만, 제가 밀려고 했을 때

git push

다음 오류가 발생했습니다.

remote: Permission to original/orirepo.git denied to mylogin.
fatal: unable to access 'https://github.com/original/orirepo.git/': The requested URL returned error: 403

내가 실수한 거 알아요.내 포크를 복제했어야 했어요.orirepo하지만 지금은 그러기엔 너무 늦었습니다.어떻게 해야 내 포크로 밀어붙일 수 있습니까?origin/orirepo내가 쓰기 권한이 없는 것?

기본적으로 리포지토리를 복제할 때

  • https://github.com/original/orirepo.git,
  • 현재 지점이 누구의 것.master,

그리고나서

  • 에는 결과 클론 구에호는라는 만 나열됩니다.origin복제한 리포지토리의 URL과 연결됩니다.
  • 자치 단체master클론의 분기가 추적하도록 설정되었습니다. origin/master.

따라서 클론의 구성을 수정하지 않으면 Git이 해석합니다.

git push

~하듯이

git push origin master:origin/master

다른말하면로,하면,git push당신의 지역을 밀고 나가려는 시도들master로분다하에 master 원격저클상분는기주하에장짐알소려론origin하지만 원격 저장소에 대한 쓰기 액세스 권한이 없기 때문에 이 작업을 수행할 수 없습니다.

당신은 해야 합니다.

  1. 다시 정의하거나.origin포크와 할 수 .

    git remote set-url origin https://github.com/RemiB/myrepo.git
    
  2. 또는, 만약 당신이 원래의 정의를 보존하고 싶다면.originremote,합니다(「 」, 「 」( 「 」))myrepo여기)는 포크와 관련된 것입니다.

    git remote add myrepo https://github.com/RemiB/myrepo.git
    

    그러면 당신은 당신의 지역을 밀어낼 수 있을 것입니다.master달리기로 당신의 포크에 가지치기

    git push myrepo master
    

    에게 에게고만당신약이말하싶고다면그리it▁g싶▁and면다▁you▁if말하▁to▁wantit▁tell고.git push.myrepoorigin은 금부터지, 당은뛰합니다야를 실행해야 .

    git push -u myrepo master
    

대신.

누군가의 레포를 복제하여 변경한 후, 레포로 이동할 수는 없지만 자신의 포크로 이동할 수 있다는 것을 깨달았습니다.그래서, 당신은 계속해서 원래의 레포를 갈랐습니다.

로컬 복제본의 오리진 URL을 포크된 레포의 URL과 스왑하기만 하면 됩니다.

그것은 이렇게 하세요.

git remote set-url origin https://github.com/fork/name.git

에▁where디https://github.com/fork/name.git원래 레포의 포크 URL입니다.

그 이후로는 그냥

git push

그리고 당신은 당신의 포크에 당신의 변경사항을 밀어 넣을 수 있을 것입니다 :)

네, 드디어 Git 구성 파일을 편집했습니다.

$ nano .git/config

변경:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = https://github.com/<origin-project>/<origin-repo>.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

로.

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url = https://github.com/<mylogin>/<myrepo>.git
        fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
        remote = origin
        merge = refs/heads/master

그리고나서,

$ git push

매력적으로 작동했습니다.

또는 티아고 F 마케도니아 덕분에 다음과 같이 대답합니다.

git remote set-url origin https://yourusername@github.com/user/repo.git

인증에 HTTPS 대신 SSH를 사용하는 경우 다음과 같이 로컬 복제본의 오리진 URL을 분기된 레포의 URL과 스왑할 수 있습니다.

git remote set-url origin git@github.com:username/repository

그렇다면 간단하게:

git push

제트브레인 IDE를 사용하는 사람들을 위해 추가하고 싶다고 생각했습니다(유사하게 다른 사람들에게도 적용될 수 있음) Git 메뉴(메뉴 바를 통해) -> 원격 관리 -> 원본 위치를 변경할 레포 아래 URL을 편집합니다(예: https://github.com/your_git_handle/your_repo_name.git

먼저 계정의 분기된 레포를 복제해야 합니다.

git clone https://github.com/your_account/repo.git

이 보고서에 푸시할 수 있는 권한이 있어야 합니다.만약 당신이 당신의 코드를 원래 레포에 푸시하고 싶다면, 당신은 꺼내기 요청을 발행할 수 있습니다.

언급URL : https://stackoverflow.com/questions/25545613/how-can-i-push-to-my-fork-from-a-clone-of-the-original-repo

반응형