{"action":"created","issue":{"url":"https://api.github.com/repos/libgit2/libgit2/issues/3021","labels_url":"https://api.github.com/repos/libgit2/libgit2/issues/3021/labels{/name}","comments_url":"https://api.github.com/repos/libgit2/libgit2/issues/3021/comments","events_url":"https://api.github.com/repos/libgit2/libgit2/issues/3021/events","html_url":"https://github.com/libgit2/libgit2/issues/3021","id":65188238,"number":3021,"title":"Unexpected HTTP status code: 401","user":{"login":"b35li","id":3079005,"avatar_url":"https://avatars.githubusercontent.com/u/3079005?v=3","gravatar_id":"","url":"https://api.github.com/users/b35li","html_url":"https://github.com/b35li","followers_url":"https://api.github.com/users/b35li/followers","following_url":"https://api.github.com/users/b35li/following{/other_user}","gists_url":"https://api.github.com/users/b35li/gists{/gist_id}","starred_url":"https://api.github.com/users/b35li/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b35li/subscriptions","organizations_url":"https://api.github.com/users/b35li/orgs","repos_url":"https://api.github.com/users/b35li/repos","events_url":"https://api.github.com/users/b35li/events{/privacy}","received_events_url":"https://api.github.com/users/b35li/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-30T11:09:24Z","updated_at":"2015-03-31T04:20:04Z","closed_at":"2015-03-30T12:01:16Z","body":"Hi \r\nI ran into an error which shows as following:\r\n```\r\nStarting....\r\npanic: Unexpected HTTP status code: 401\r\n\r\ngoroutine 1 [running]:\r\nmain.clone()\r\n\t/var/www/dev/test/gitcli.go:33 +0x14f\r\nmain.main()\r\n\t/var/www/dev/test/gitcli.go:78 +0xdf\r\n\r\ngoroutine 17 [syscall, locked to thread\r\n```\r\n\r\nDoes anybody know how I fix the problem? Thanks very much, it blocks me two days.\r\nhere is snippet of code: \r\n```\r\n  3 import (\r\n  4     \"fmt\"\r\n  5 \r\n  6     \"gopkg.in/libgit2/git2go.v22\"\r\n  7 )\r\n  8 \r\n  9 func credentialsCallback(url string, username string, allowedTypes git.CredType) (git.ErrorCode, *git.Cred) {\r\n 10     // Tried my OS X username, Github username and 'git' here\r\n 11     // I also tried git.NewCredSshKeyFromAgent below\r\n 12     ret, cred := git.NewCredSshKey(\"git\", \"~/.ssh/id_rsa.pub\", \"~/.ssh/id_rsa\", \"\")\r\n 13     fmt.Println(cred.Type())\r\n 14     return git.ErrorCode(ret), &cred\r\n 15 }\r\n 16 \r\n 17 // Made this one just return 0 during troubleshooting...\r\n 18 func certificateCheckCallback(cert *git.Certificate, valid bool, hostname string) git.ErrorCode {\r\n 19     return 0\r\n 20 }\r\n 21 \r\n 23 func clone() {\r\n 24     cb := &git.RemoteCallbacks{\r\n 25         CredentialsCallback: credentialsCallback,\r\n 26         CertificateCheckCallback: certificateCheckCallback,\r\n 27     }\r\n 28     co := &git.CloneOptions{\r\n 29         RemoteCallbacks: cb,\r\n 30     }\r\n 31     repo, err := git.Clone(\"http://{username}@{internalproject}\", \"proj\", co)\r\n 32     if err != nil {\r\n 33         panic(err)\r\n 34     }\r\n 35     fmt.Println(repo.Config())\r\n 36 }\r\n\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/libgit2/libgit2/issues/comments/87931193","html_url":"https://github.com/libgit2/libgit2/issues/3021#issuecomment-87931193","issue_url":"https://api.github.com/repos/libgit2/libgit2/issues/3021","id":87931193,"user":{"login":"b35li","id":3079005,"avatar_url":"https://avatars.githubusercontent.com/u/3079005?v=3","gravatar_id":"","url":"https://api.github.com/users/b35li","html_url":"https://github.com/b35li","followers_url":"https://api.github.com/users/b35li/followers","following_url":"https://api.github.com/users/b35li/following{/other_user}","gists_url":"https://api.github.com/users/b35li/gists{/gist_id}","starred_url":"https://api.github.com/users/b35li/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b35li/subscriptions","organizations_url":"https://api.github.com/users/b35li/orgs","repos_url":"https://api.github.com/users/b35li/repos","events_url":"https://api.github.com/users/b35li/events{/privacy}","received_events_url":"https://api.github.com/users/b35li/received_events","type":"User","site_admin":false},"created_at":"2015-03-31T04:20:04Z","updated_at":"2015-03-31T04:20:04Z","body":"@ethomson I will do that. thanks for your quick reply."}}