Giter VIP home page Giter VIP logo

Comments (7)

wolf-yuan-6115 avatar wolf-yuan-6115 commented on August 11, 2024 1

Maybe it's because https://github.com/coder/envbuilder/blob/main/envbuilder.go#L357-L358 passing Git username as (blank) and password as (blank)?

So GitHub might resolve it as not logged in but other git provider resolved it as user not found

from envbuilder.

AisonSu avatar AisonSu commented on August 11, 2024 1

Oh guys, I don't think this is a bug, because I initially encountered the same problem as you did, but I solved it by looking at the documentation – of course, I have to say that the information here is really incomplete, which took me half a day to figure out.

Here's my solution:

Firstly, you need to add an OAuth2 application on your Gitea/GitLab/Bitbucket, and the URI address is documented here; please modify it according to your actual situation.

Secondly, you need to add the relevant environment variables as guided in the documentation. Please note that all variables should not be enclosed in double quotes and ensure that the CODER_ACCESS_URL environment variable is set correctly.

Lastly, modify the template file by adding the following block of "coder_external_auth" data:

data "coder_external_auth" "any name you like here" {
    id = the CODER_EXTERNAL_AUTH_0_ID you set in the first step
}

And within the "resource" "docker_container" "workspace", add the following environment variables:

env {
    "GIT_USERNAME=oauth",
    "GIT_PASSWORD=${data.coder_external_auth.the name you set in the second step.access_token}"
}

and then click "Build" and then "Publish".


After completing all these steps,You will find that your workspace creation now includes an additional repository authorization option. Complete the authorization, and you will be able to perform a normal git clone.

from envbuilder.

nwrkbiz avatar nwrkbiz commented on August 11, 2024 1

Hi, I have implemented a fix for this, you can test this using following image:
ghcr.io/nwrkbiz/envbuilder:0.2.6.0

from envbuilder.

ggjulio avatar ggjulio commented on August 11, 2024

Hi, I have the exact same issue on bitbucket server . (but works fine with github repos)
It creates an empty folder named repo_name or repo_name.git (based on the url)
Cloning manually inside the fallback image works fine however.

envbuilder version : 0.2.3

from envbuilder.

sthdev avatar sthdev commented on August 11, 2024

I have the same issue with envbuilder 0.2.4.

from envbuilder.

sthdev avatar sthdev commented on August 11, 2024

I got it working by explicitly setting access credentials for GitLab (the git repository containing the .devcontainer spec is located on my GitLab instance). However, the Git repository is public. There should be no need to authenticate to GitLab.

In contrast, envbuilder can access public GitHub repositories without problems. Is there a special handling for GitHub repositories? From the comments above, it seems that this problem only occurs with non-GitHub repos.

BTW, I am using envbuilder in a Coder template (Coder 2.3.3) running on K8s 1.24.

from envbuilder.

ggjulio avatar ggjulio commented on August 11, 2024

Hi @AisonSu,
Your solution seem to work because envbuilder now run authenticated queries against the git SCM provider.

However if for some reason we can't set up an oauth app, clones of public repos will fail. (Except on GitHub which works fine)

wolf-yuan-6115 is probably right about the root cause.

from envbuilder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.