Jenkins blue ocean change github access token

Viewed 12503

Jenkins blue ocean pretty cool continuous integration tool, but I faced the following problem:

At the main page, as was asked, I inserted my GitHub access token

jenkins generate access token

And after that I realized that was incorrect token from another company.
And now I want to change to another token but there is no option to do that. I'm always getting the following screen without the possibility to change the key.

no way to change github access token

I found out that if I the token was deleted from GiHub tokens page I can insert the new one at the page depicted above. But now there is no way to delete that token. I need to resolve the problem from Jenkins UI.

Any Ideas how to change?

5 Answers

I tried many things, at the moment best solution is to delete project and create new blueocean project with new credentials.

Add a new credential in Jenkins and choose "Username and Password" as the type. The username should be your GitHub username and the password is the API token. Make sure the credential is added to a store that the project has access to.

tkausl's instructions didn't work for me because there was no "Delete" or "Modify" button. So here is my extended solution (it needs shell access).

With shell access, you can find the file where your token is stored (in my case it was ./users//config.xml). However, you cannot just edit that file, because the token is stored in encrypted form (and base64-encoded). So instead, create a new dummy credential with the correct token. The dummy credential gets added (in encrypted form) in the file ./credentials.xml. Open that file and copy the password (in base64 and encrypted form) into where the actual credentials are (./users//config.xml). Finally, go to "Manage Jenkins" > "Reload Configuration from Disk".

I think @bhow has something similar but just to make it clear - you don't need to delete the project or the existing token.

You can go to Blue Ocean, choose the project and then choose the gear icon to change the project settings.

Under "Branch Sources" you'll see the current Github credentials. From there you can choose to add new credentials. In my case I added a new "Username with password" where the username was my username, and password was my Github token. By choosing this new option from the credentials dropdown I could see that the authenticated user changed.

Related