"organization has enabled or enforced SAML SSO. To access remote: this repository" Error on Docker Build
Asked Answered
M

6

32
FROM golang:1.17-alpine as builder
ENV GOPRIVATE=github.com/XXXXX/
ARG GITHUB_TOKEN=$GITHUB_TOKEN
RUN apk update && apk add git gcc g++ libc-dev librdkafka-dev pkgconf && mkdir /app && git config --global url."https://someusername:[email protected]".insteadOf "https://github.com"
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY ./ /app
RUN go build -tags dynamic


FROM alpine:3.1
RUN addgroup -S app && \
    apk add --no-cache librdkafka-dev
RUN mkdir /logs && mkdir /app
WORKDIR /app
USER app
EXPOSE 8000 8001 8002
CMD ["./main"]

fatal: could not read Username for 'https://github.com': terminal prompts disabled Confirm the import path was entered correctly. If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.

Any idea how can I fix it inside docker

Mychal answered 6/1, 2022 at 1:17 Comment(0)
M
54

When you're in an organization that uses SAML SSO, every personal access token that's used to access that organization's resources has to be specifically enabled for that organization.

You can go into the Personal Access Token settings and choose "Configure SSO". From there, you can enable the token for the specific organization that you're using. After that point, using it as normal should work.

Mohun answered 6/1, 2022 at 3:22 Comment(3)
I have already enabled that. Still it is failing – Mychal
For me it kept failing after enabling SSO for the token. Solution for me was to also enable SSO for the SSH key! – Hierarchize
This works but also needs Clemens answer (see below) – Lend
H
19

Double check if you have an SSH key associated with your account (https://github.com/settings/keys) and make sure it has SSO enabled as well.

Hierarchize answered 23/6, 2022 at 15:12 Comment(1)
As I see we need to associate each of our tokens with the organisation. I associated both, "Personal Access Token settings and choose "Configure SSO" and "SSH key" with my organisation and that helped to me. πŸ‘πŸΌ – Krasnodar
S
4

I tried the suggestions for this to no avail.

The only way I could overcome this was by downloading the GitHub CLI and running:

gh auth login

This resolved the warning about SSO and OAuth.

Shellishellie answered 15/5, 2023 at 10:10 Comment(0)
C
2

For me it was clicking on the authorize button of the ssh key.

Go to SSH and GPG Keys in settings > click configure SSO > click authorize.

As shown in the image (it shows deauth because I have done the auth) for you it will say authorize.

enter image description here

Copyboy answered 15/3 at 21:2 Comment(0)
W
0

As answered above, make sure you go to personal access settings and ensure that configure sso for your token includes your ORGANIZATION-NAME. Additionally, I had to do an extra step for it work. I went to https://github.com/orgs/ORGANIZATION-NAME/sso

Source: https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/about-authentication-with-saml-single-sign-on

Wolter answered 10/6, 2022 at 23:15 Comment(0)
O
0

Thought this might be helpful for other, While adding signing ssh key in git hub

In the upper-right corner of any page, click your profile photo, then click Settings --> SSH and PGP Keys --> new ssh key

Select the type of key as signing

there are authentication and signing options

Oscillator answered 24/2 at 13:27 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.