Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 371
SMix Avatar asked May 17 '17 20:05

SMix


2 Answers

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.
like image 112
Jérôme Verstrynge Avatar answered Sep 22 '22 11:09

Jérôme Verstrynge


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!

like image 44
JRVCIO Avatar answered Sep 18 '22 11:09

JRVCIO