{"action":"closed","issue":{"url":"https://api.github.com/repos/allegro/axion-release-plugin/issues/32","labels_url":"https://api.github.com/repos/allegro/axion-release-plugin/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/allegro/axion-release-plugin/issues/32/comments","events_url":"https://api.github.com/repos/allegro/axion-release-plugin/issues/32/events","html_url":"https://github.com/allegro/axion-release-plugin/issues/32","id":51423837,"number":32,"title":"NPE on pushing changes to GitHub with GH_TOKEN","user":{"login":"szpak","id":148013,"avatar_url":"https://avatars.githubusercontent.com/u/148013?v=3","gravatar_id":"","url":"https://api.github.com/users/szpak","html_url":"https://github.com/szpak","followers_url":"https://api.github.com/users/szpak/followers","following_url":"https://api.github.com/users/szpak/following{/other_user}","gists_url":"https://api.github.com/users/szpak/gists{/gist_id}","starred_url":"https://api.github.com/users/szpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/szpak/subscriptions","organizations_url":"https://api.github.com/users/szpak/orgs","repos_url":"https://api.github.com/users/szpak/repos","events_url":"https://api.github.com/users/szpak/events{/privacy}","received_events_url":"https://api.github.com/users/szpak/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/allegro/axion-release-plugin/milestones/3","html_url":"https://github.com/allegro/axion-release-plugin/milestones/1.0.1","labels_url":"https://api.github.com/repos/allegro/axion-release-plugin/milestones/3/labels","id":879115,"number":3,"title":"1.0.1","description":null,"creator":{"login":"adamdubiel","id":5269406,"avatar_url":"https://avatars.githubusercontent.com/u/5269406?v=3","gravatar_id":"","url":"https://api.github.com/users/adamdubiel","html_url":"https://github.com/adamdubiel","followers_url":"https://api.github.com/users/adamdubiel/followers","following_url":"https://api.github.com/users/adamdubiel/following{/other_user}","gists_url":"https://api.github.com/users/adamdubiel/gists{/gist_id}","starred_url":"https://api.github.com/users/adamdubiel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamdubiel/subscriptions","organizations_url":"https://api.github.com/users/adamdubiel/orgs","repos_url":"https://api.github.com/users/adamdubiel/repos","events_url":"https://api.github.com/users/adamdubiel/events{/privacy}","received_events_url":"https://api.github.com/users/adamdubiel/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":2,"state":"closed","created_at":"2014-11-24T23:03:41Z","updated_at":"2015-03-29T21:11:17Z","due_on":null,"closed_at":"2015-02-16T21:38:47Z"},"comments":6,"created_at":"2014-12-09T12:51:33Z","updated_at":"2015-03-29T21:11:17Z","closed_at":"2015-03-29T21:11:17Z","body":"An alternative way to push changes to GitHub (useful especially from CI server) is the usage of personal access token. Unfortunately it fails with NPE from jgit.\r\n\r\n```\r\nCaused by: java.lang.NullPointerException\r\n\tat org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:476)\r\n\tat org.eclipse.jgit.transport.TransportHttp.openPush(TransportHttp.java:396)\r\n\tat org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:154)\r\n\tat org.eclipse.jgit.transport.Transport.push(Transport.java:1173)\r\n\tat org.eclipse.jgit.api.PushCommand.call(PushCommand.java:156)\r\n\tat org.eclipse.jgit.api.PushCommand.call(PushCommand.java:79)\r\n\tat java_util_concurrent_Callable$call.call(Unknown Source)\r\n\tat pl.allegro.tech.build.axion.release.infrastructure.git.GitRepository.push(GitRepository.groovy:80)\r\n\tat pl.allegro.tech.build.axion.release.domain.scm.ScmRepository$push$5.call(Unknown Source)\r\n\tat pl.allegro.tech.build.axion.release.domain.Releaser.release(Releaser.groovy:42)\r\n\tat pl.allegro.tech.build.axion.release.domain.Releaser$release.call(Unknown Source)\r\n\tat pl.allegro.tech.build.axion.release.ReleaseTask.release(ReleaseTask.groovy:40)\r\n(...)\r\n```\r\n\r\nI debugged it briefly and GH returns 401 on the first connection try and in the second attempt it does not have a credential provider which causes NPE. In jgit master they modified code and more verbose TransportException would be probably [throw](https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java#L497).\r\n\r\nI din't dig into that, but the connection URI is:\r\n```\r\nhttps://my-very-long-token@github.com/foo/bar.git/info/refs?service=git-receive-pack\r\n```\r\n\r\nwhich returns 401 (Unathorized). After change it (in debuger) to just `https://my-very-long-token@github.com/foo/bar.git/` it returns 200, but later fails on `NotSupportedException: remote does not support smart HTTP push`.\r\n\r\nSteps to reproduce:\r\n1. Checkout any project with Axion configured from GH.\r\n2. Change remote url to url = https://${YOUR_GH_TOKEN}@github.com/you/your-project.git\r\n3. Call `./gradlew release`.\r\n\r\nBtw, manual push with mentioned configuration works fine. Tested with Axion 0.9.9."}}