2016-12-05 6 views
0

Ich folge der Anleitung @https://developer.github.com/guides/getting-started/ bei https://developer.github.com/guides/getting-started/#create-a-repositoryVersuch Github Repo mit curl

stecken geblieben zu erstellen, wenn ich

curl -i -v -H "Authorization: token ##############################" -H -d @create.txt https://api.github.com/user/repos 

Hier ist create.txt laufen:

"{ "name":"blog", 
    "auto_init":true, 
    "private":true, 
    "gitignore_template":"nanoc" 
     }" 

Diese ist das Ergebnis:

Trying 192.30.253.116... 
* TCP_NODELAY set 
* Connected to api.github.com (192.30.253.116) port 443 (#0) 
* ALPN, offering h2 
* ALPN, offering http/1.1 
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 
* successfully set certificate verify locations: 
* CAfile: C:\Curl\ca-bundle.crt 
    CApath: none 
* TLSv1.2 (OUT), TLS header, Certificate Status (22): 
* TLSv1.2 (OUT), TLS handshake, Client hello (1): 
* TLSv1.2 (IN), TLS handshake, Server hello (2): 
* TLSv1.2 (IN), TLS handshake, Certificate (11): 
* TLSv1.2 (IN), TLS handshake, Server key exchange (12): 
* TLSv1.2 (IN), TLS handshake, Server finished (14): 
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16): 
* TLSv1.2 (OUT), TLS change cipher, Client hello (1): 
* TLSv1.2 (OUT), TLS handshake, Finished (20): 
* TLSv1.2 (IN), TLS change cipher, Client hello (1): 
* TLSv1.2 (IN), TLS handshake, Finished (20): 
* SSL connection using TLSv1.2/ECDHE-RSA-AES128-GCM-SHA256 
* ALPN, server accepted to use http/1.1 
* Server certificate: 
* subject: C=US; ST=California; L=San Francisco; O=GitHub, Inc.; CN=*.github.com 
* start date: Apr 8 00:00:00 2014 GMT 
* expire date: Apr 12 12:00:00 2017 GMT 
* subjectAltName: host "api.github.com" matched cert's "*.github.com" 
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=DigiCert SHA2 High Assurance Server CA 
* SSL certificate verify ok. 
> POST /user/repos HTTP/1.1 
> Host: api.github.com 
> User-Agent: curl/7.51.0 
> Accept: */* 
> Authorization: token ########################################### 
> Content-Type: application/json 
> Content-Length: 100 
> 
* upload completely sent off: 100 out of 100 bytes 
< HTTP/1.1 404 Not Found 
HTTP/1.1 404 Not Found 
< Server: GitHub.com 
Server: GitHub.com 
< Date: Mon, 05 Dec 2016 09:31:43 GMT 
Date: Mon, 05 Dec 2016 09:31:43 GMT 
< Content-Type: application/json; charset=utf-8 
Content-Type: application/json; charset=utf-8 
< Content-Length: 87 
Content-Length: 87 
< Status: 404 Not Found 
Status: 404 Not Found 
< X-RateLimit-Limit: 5000 
X-RateLimit-Limit: 5000 
< X-RateLimit-Remaining: 4985 
X-RateLimit-Remaining: 4985 
< X-RateLimit-Reset: 1480931012 
X-RateLimit-Reset: 1480931012 
< X-OAuth-Scopes: gist 
X-OAuth-Scopes: gist 
< X-Accepted-OAuth-Scopes: public_repo, repo 
X-Accepted-OAuth-Scopes: public_repo, repo 
< X-GitHub-Media-Type: github.v3 
X-GitHub-Media-Type: github.v3 
< Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval 
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval 
< Access-Control-Allow-Origin: * 
Access-Control-Allow-Origin: * 
< Content-Security-Policy: default-src 'none' 
Content-Security-Policy: default-src 'none' 
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload 
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload 
< X-Content-Type-Options: nosniff 
X-Content-Type-Options: nosniff 
< X-Frame-Options: deny 
X-Frame-Options: deny 
< X-XSS-Protection: 1; mode=block 
X-XSS-Protection: 1; mode=block 
< X-GitHub-Request-Id: 7BED4AC8:15602:174E4027:584533FE 
X-GitHub-Request-Id: 7BED4AC8:15602:174E4027:584533FE 

< 
{ 
    "message": "Not Found", 
    "documentation_url": "https://developer.github.com/v3" 
} 
* Curl_http_done: called premature == 0 
* Connection #0 to host api.github.com left intact 

Ich bin neu in Git und StackExchange :).

Vermisse ich den Trick mit create.txt?

Vielen Dank für Ihre Zeit.

+0

ich nie GitHub API verwendet, aber von api docs (nicht Führer) es sieht aus wie Sie ** OAuth Umfang ** fehlen. Ohne den Bereich soll es ein schreibgeschützter Zugriff sein => führt zu einem Fehler. Siehe [create api (OAuth-Anforderungen)] (https://developer.github.com/v3/repos/#oauth-scope-requirements). – IrLED

+0

GitHub Dokumente vorschlagen, dass Sie das noch nicht tun können: https://developer.github.com/v3/repos/#create "(Derzeit nicht für Integrationen aktiviert)" – bcmcfc

+0

@ IrLED Ich definierte den OAuth-Bereich beim Erstellen des Tokens, ist das das? .. –

Antwort

0

Von GitHub OAuth api doc

prüfen Header zu sehen, was OAuth Tive Sie haben, und dem, was die API Aktion akzeptiert.

curl -H "Authorization: token OAUTH-TOKEN" https://api.github.com/users/technoweenie -I 
HTTP/1.1 200 OK 
X-OAuth-Scopes: repo, user 
X-Accepted-OAuth-Scopes: user 

X-OAuth-Scopes listet die Bereiche Token hat autorisiert. X-Accepted-OAuth-Scopes listet die Bereiche auf, die die Aktion auf prüft.

Ihr Token wird für gist autorisierte

< X-OAuth-Scopes: gist 
X-OAuth-Scopes: gist 
< X-Accepted-OAuth-Scopes: public_repo, repo 
X-Accepted-OAuth-Scopes: public_repo, repo