How can I setup access to a private github repository in Openshift 3?
Asked Answered
G

2

7

Well, i'm using Openshift to host a node.js application, and some things need to be private. So i need to let Openshift acess my Git repository in private. I found some tutorials in the internet, but no one helped me. I tried using PuTTY, i used Git Bash, but i failed everytime. Everytime i get this error from Openshift:

error: build error: failed to fetch requested repository "myrepository.git" with provided credentials

(i changed the repository url in the error)

Well, what can i do to setup Openshift to acess a private repository? I'm using OpenShift 3.

Gatekeeper answered 17/5, 2017 at 20:12 Comment(3)
If you are using OpenShift 3, what you need are source clone secrets. See docs.openshift.com/container-platform/3.5/dev_guide/builds/… Be careful you aren't looking at older OpenShift 2 documentation. If something mentions rhc it is for OpenShift 2, not OpenShift 3.Wetterhorn
"Command "new-basicauth" is deprecated, use oc create secret"Pleasantry
Apart from steps from Jérôme Verstrynge, what worked for me is changing the repo from "Clone with HTTPS, github.com.........." to "Clone with SSH, [email protected]:red.........." as shown in the screenshotBircher
B
16

It took me a bit of time to figure it out, since the last step is missing in the configuration.

In order to give OpenShift 3 access to a private github repository, I performed the following:

> oc secrets new-basicauth github-credentials --username=<yourgithubusername> --password=<yourgithubpassword>

It returns:

secret/github-credentials

Then (and here is the missing part) from the Openshift 3 web interface:

  1. Click on Build
  2. Click on your application's link
  3. On the top right, click on Action and select Edit
  4. Underneath Git Repository URL, click on Advanced Options
  5. In Source Secrets, select github-credentials
  6. Click on Save at the bottom of the screen.
Bigoted answered 19/8, 2017 at 12:56 Comment(0)
C
3

You can try this solution: consider that I am using openshift version 3.11 So, on the left side menu click on "Builds" then "Builds" again, then click on the name of your project, now click on the action button and select "edit" option. now click on "Show advanced options", in the Build Secret Section "Create New Secret", put a new secret name and the user name and password that you use for the private repository. Now select a build secret that you have created. That is all!

Cookstove answered 18/2, 2019 at 17:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.