오류 코드 403을 반환하는 Git으로 푸시 치명적 : HTTP 요청 실패 port 443 (#0) * successfully

HTTPS 인증을 통해이 리포지토리의 복사본을 복제 할 수있었습니다. 커밋을하고 GitHub 서버로 다시 밀어 넣고 싶습니다. Windows 7 x64에서 Cygwin 사용

C:\cygwin\home\XPherior\Code\lunch_call>git push
Password:
error: The requested URL returned error: 403 while accessing https://MichaelDrog
alis@github.com/derekerdmann/lunch_call.git/info/refs

fatal: HTTP request failed

또한 상세 모드로 설정하십시오. 나는 아직도 꽤 당황합니다.

C:\cygwin\home\XPherior\Code\lunch_call>set GIT_CURL_VERBOSE=1

C:\cygwin\home\XPherior\Code\lunch_call>git push
Password:
* Couldn't find host github.com in the _netrc file; using defaults
* About to connect() to github.com port 443 (#0)
*   Trying 207.97.227.239... * 0x23cb740 is at send pipe head!
* Connected to github.com (207.97.227.239) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: C:\Program Files (x86)\Git/bin/curl-ca-bundle.crt
  CApath: none
* SSL connection using AES256-SHA
* Server certificate:
*        subject: 2.5.4.15=Private Organization; 1.3.6.1.4.1.311.60.2.1.3=US; 1.
3.6.1.4.1.311.60.2.1.2=California; serialNumber=C3268102; C=US; ST=California; L
=San Francisco; O=GitHub, Inc.; CN=github.com
*        start date: 2011-05-27 00:00:00 GMT
*        expire date: 2013-07-29 12:00:00 GMT
*        subjectAltName: github.com matched
*        issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert High Ass
urance EV CA-1
*        SSL certificate verify ok.
> GET /derekerdmann/lunch_call.git/info/refs?service=git-receive-pack HTTP/1.1
User-Agent: git/1.7.4.3282.g844cb
Host: github.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: nginx/1.0.4
< Date: Thu, 15 Sep 2011 22:44:41 GMT
< Content-Type: text/plain
< Connection: keep-alive
< Content-Length: 55
< WWW-Authenticate: Basic realm="GitHub"
<
* Ignoring the response-body
* Expire cleared
* Connection #0 to host github.com left intact
* Issue another request to this URL: 'https://MichaelDrogalis@github.com/dereker
dmann/lunch_call.git/info/refs?service=git-receive-pack'
* Couldn't find host github.com in the _netrc file; using defaults
* Re-using existing connection! (#0) with host github.com
* Connected to github.com (207.97.227.239) port 443 (#0)
* 0x23cb740 is at send pipe head!
* Server auth using Basic with user 'MichaelDrogalis'
> GET /derekerdmann/lunch_call.git/info/refs?service=git-receive-pack HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
User-Agent: git/1.7.4.3282.g844cb
Host: github.com
Accept: */*
Pragma: no-cache

< HTTP/1.1 401 Authorization Required
< Server: nginx/1.0.4
< Date: Thu, 15 Sep 2011 22:44:41 GMT
< Content-Type: text/plain
< Connection: keep-alive
< Content-Length: 55
* Authentication problem. Ignoring this.
< WWW-Authenticate: Basic realm="GitHub"
* The requested URL returned error: 401
* Closing connection #0
* Couldn't find host github.com in the _netrc file; using defaults
* About to connect() to github.com port 443 (#0)
*   Trying 207.97.227.239... * 0x23cb740 is at send pipe head!
* Connected to github.com (207.97.227.239) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: C:\Program Files (x86)\Git/bin/curl-ca-bundle.crt
  CApath: none
* SSL re-using session ID
* SSL connection using AES256-SHA
* old SSL session ID is stale, removing
* Server certificate:
*        subject: 2.5.4.15=Private Organization; 1.3.6.1.4.1.311.60.2.1.3=US; 1.
3.6.1.4.1.311.60.2.1.2=California; serialNumber=C3268102; C=US; ST=California; L
=San Francisco; O=GitHub, Inc.; CN=github.com
*        start date: 2011-05-27 00:00:00 GMT
*        expire date: 2013-07-29 12:00:00 GMT
*        subjectAltName: github.com matched
*        issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert High Ass
urance EV CA-1
*        SSL certificate verify ok.
* Server auth using Basic with user 'MichaelDrogalis'
> GET /derekerdmann/lunch_call.git/info/refs HTTP/1.1
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
User-Agent: git/1.7.4.3282.g844cb
Host: github.com
Accept: */*
Pragma: no-cache

* The requested URL returned error: 403
* Expire cleared
* Closing connection #0
error: The requested URL returned error: 403 while accessing https://MichaelDrog
alis@github.com/derekerdmann/lunch_call.git/info/refs

fatal: HTTP request failed

이들은 내가 가지고있는 git 및 curl 버전입니다.

C:\Users\XPherior>git --version
git version 1.7.4.msysgit.0

C:\Users\XPherior>curl --version
curl 7.21.7 (amd64-pc-win32) libcurl/7.21.7 OpenSSL/0.9.8r zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp
smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate Largefile NTLM SSL SSPI libz


답변

방금 동일한 문제가 발생하여 원인을 파악했습니다.

Github는 repo를 읽고 쓰는 ssh 방법 만 지원하지만 https 방법에는 ‘읽기 및 쓰기’가 표시됩니다.

따라서 PC의 repo 구성을 ssh 방식으로 변경해야합니다.

  1. .git/configrepo 디렉토리 아래의 파일 편집
  2. url=섹션에서 항목 찾기[remote "origin"]
  3. 에서 변경 url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.giturl=ssh://git@github.com/derekerdmann/lunch_call.git. 즉, @기호 앞의 모든 텍스트 를ssh://git
  4. config파일을 저장 하고 종료하십시오. 이제 git push origin masterGitHub에서 repo를 동기화 하는 데 사용할 수 있습니다

답변

https프로토콜을 사용하여 로그인 할 수 있으려면 먼저 인증 자격 증명 을 git Remote URI 합니다 .

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

그런 다음에 시도 할 때 비밀번호를 묻는 메시지가 표시됩니다 git push.

실제로 이것은 http 인증 형식입니다. 비밀번호도 설정할 수 있습니다.

https://youruser:password@github.com/user/repo.git

이 작업을 수행하면 github 비밀번호가 .git 디렉토리의 일반 텍스트로 저장되므로 바람직하지 않습니다.


답변

Sean의 답변에 하나의 작은 추가 .

.git/config파일을 수동으로 편집하는 대신 사용할 수 있습니다git remote set-url 명령 .

귀하의 경우 다음과 같아야합니다.

git remote set-url origin ssh://git@github.com/derekerdmann/lunch_call.git

나는 도트 파일을 엉망으로 만드는 것보다 쉽고 깨끗하다는 것을 알았습니다.


답변

.git/configrepo 디렉토리 아래의 파일 편집

url=섹션에서 항목 찾기[remote "origin"]

에서 변경 url=https://github.com/rootux/ms-Dropdown.git
https://USERNAME@github.com/rootux/ms-Dropdown.git

USERNAMEgithub 사용자 이름은 어디에 있습니까


답변

SSH로 전환을 제안하는 다른 답변은 요점을 놓친 것입니다. HTTPS는 지원되지만 SSH 암호가 아닌 GITHUB 비밀번호로 로그인해야합니다 (이것은 정확한 오류를 발생 시켰습니다).

나는 같은 문제가 있었지만 터미널 암호 프롬프트에서 실제 GitHub 암호를 사용하면 구성을 변경하거나 SSH를 사용하지 않고 솔루션을 수정했습니다.

이 점을 명심해야하는 이유는 많은 학교 (예 : 학교)가 SSH를 차단하지만 HTTPS를 허용하기 때문입니다 (이는 HTTPS를 통해 복제를 시작한 유일한 이유입니다).

다른 사람이 같은 문제를 겪는 데 도움이되기를 바랍니다.


답변

Mac OS X 에서 동일한 오류 및 해결 방법.

GitHub 에서 새 계정을 만들고 푸시하려고 할 때까지 모든 것이 잘 작동했습니다.

$ git push -u origin master

그리고 오류가 발생했습니다 :

remote : NEWUSER / NEWREPO.git에 대한 권한이 OLDUSER에 거부되었습니다. 치명적 : ‘ https://github.com/NEWUSER/NEWREPO.git/ 에 액세스 할 수 없습니다 ‘ : 요청한 URL에서 오류를 반환했습니다 : 403

전역 또는 현재 저장소에 대해 user.name을 설정하여 수정해야합니다.

$ git config –-global user.name NEWUSER
$ git config user.name NEWUSER

그러나 그렇지 않았습니다.

비밀번호 섹션 아래의 Keychain Access 앱 에서 GitHub와 관련된 OLDUSER를 삭제하여 수정했습니다 . 그런 다음 푸시 명령이 성공했습니다.

$ git push -u origin master

참고


답변

Windows를 사용하는 경우 Windows가 자체 저장소에 외부 리포지토리 (이 경우 github)의 자격 증명을 저장하기 때문에 이러한 상황이 발생할 수 있습니다. 거기에 저장된 자격 증명은 현재 필요한 자격 증명과 다를 수 있습니다.

따라서이 문제를 피하려면이 저장소에서 github를 찾아 저장된 자격 증명을 삭제하십시오. 이 후 git을 누르면 자격 증명을 요청하고 푸시 할 수 있습니다.