2013-10-27 2 views
9

내 개인 서버를 내 기본 자식 호스트로 지정하고 자동으로 github에 미러링하려고합니다. 나는 this article을 찾았는데, 주로 post-receive 스크립트가 git push --mirror (본질적으로)으로 동작합니다.자체 호스트 git 저장소를 github.com으로 미러링 (인증 실패)

내 접근 방식은 배포 키를 만들고 보안을 설정하지 않고 모든 저장소에서 구성하지 않아도된다는 점에서 다릅니다.

위의 블로그 기사 에서처럼 전체 nohup + stdio 리디렉션 + backgrounding을 수행 할 때를 제외하고 내 수령 스크립트는 아래의 대부분의 변형에서 올바르게 작동합니다. 인증이 작동하지 않습니다.

GITHUB_USERNAME=focusaurus 
BARE_PATH=$(pwd -P) 
REPO_NAME=$(basename "${BARE_PATH}") 
REPO_URL="ssh://[email protected]/${GITHUB_USERNAME}/${REPO_NAME}" 
echo "About to mirror to ${REPO_URL}" 

#hmm, this works 
#git push --mirror "${REPO_URL}" 

#this works, too 
#nohup git push --mirror "${REPO_URL}" 

#and this also works OK 
nohup git push --mirror "${REPO_URL}" & 

#but this fails with 
#Permission denied (publickey). 
#fatal: The remote end hung up unexpectedly 
#Somehow ssh agent forwarding must get screwed up? Help me, Internet. 
#nohup git push --mirror "${REPO_URL}" &>>/tmp/mirror_to_github.log & 

#this is the one used in the blog post above but it also fails 
# nohup git push --mirror "${REPO_URL}" &>/dev/null & 

나는 작동하는 버전이 작동하는 방법이라고 생각하는 ssh 에이전트 포워딩을 사용합니다. 그래서 내 질문에 그 마지막 2 유사 콘텐츠 인증 오류와 함께 실패합니까?

+0

오류가 이러한 변경으로 인한 것이지 다른 것이 아닌 것은 확실합니까? –

+0

예. 나는 위의 모든 맛을 테스트했으며 주석에 따라 "작동 OK"로 표시된 작업은 안정적으로 작동 한 다음 stdio가 일관되게 처리되는 방식을 변경하면 오류가 발생합니다. –

+0

그래서 ssh 설정에서 문제가있는 것 같습니다. 조사 중입니다. –

답변

1

아마도 ssh에 자세한 플래그를 설정하여 문제가 무엇인지 알 수 있습니다.

환경 변수 GIT_SSH을 사용하여 git에서 ssh 연결을 여는 명령을 대체 할 수 있습니다. 남자 페이지에서 :

GIT_SSH 
     If this environment variable is set then git fetch and git push 
     will use this command instead of ssh when they need to connect to a 
     remote system. The $GIT_SSH command will be given exactly two 
     arguments: the [email protected] (or just host) from the URL and the 
     shell command to execute on that remote system. 

     To pass options to the program that you want to list in GIT_SSH you 
     will need to wrap the program and options into a shell script, then 
     set GIT_SSH to refer to the shell script. 

그래서처럼 보이는 /tmp/verb-ssh에서 스크립트 : 환경 변수 GIT_SSH=/tmp/verb-ssh를 설정 한 후

#!/bin/bash 
/usr/bin/ssh -vvv "[email protected]" 

및 유용한 디버깅 정보를 제공해야한다.

+0

글쎄, 그것은 디버그 출력을 얻기위한 훌륭한 팁입니다. 나는 아직도 근본 원인을 이해할 수 없다. 그러나 나는 단지 KISS에 가려고 생각한다. 그리고 그것이 대체로 빠른 it 's로서 foreground에서 github에 밀어 넣을 것을 어떻게해도 떠난다. –

관련 문제