#Is there anything I need to configure to run https private git repo on github?

1 messages · Page 1 of 1 (latest)

edgy estuary
#

I'm trying to do this private https git repo as a module.
And I get:

dagger core git --url https://github.com/<private-org>/<internal-repo>.git
✔ connect 0.1s
✔ inspecting core types 0.3s
✔ parsing command line arguments 0.0s
✔ git(url: "https://github.com/<private-org>/<internal-repo>.git"): GitRepository! 0.2s
✘ GitRepository.tags: [String!]! 0.2s
! git command failed: exit status 128

Setup tracing at https://dagger.cloud/traces/setup. To hide: export STOPIT=1

Error: response from query: input: git.withAuthToken.tags resolve: git command failed: exit status 128
stdout:
stderr: fatal: could not read Username for 'https://github.com': No such device or address

normal git clone works:

git clone https://github.com/<private-org>/<internal-repo>.git
Cloning into '<internal-repo>'...
remote: Enumerating objects: 83797, done.
remote: Counting objects: 100% (7264/7264), done.
remote: Compressing objects: 100% (2524/2524), done.
remote: Total 83797 (delta 4611), reused 6828 (delta 4300), pack-reused 76533 (from 1)
Receiving objects: 100% (83797/83797), 34.60 MiB | 2.00 MiB/s, done.
Resolving deltas: 100% (52906/52906), done.

So what have I missed?

I'm running v0.14.0 version of dagger

restive mortar
#

Hey!

You need to authenticate somehow, I was not able to get HTTP auth to work using the built-in with-auth-token function though :/

I was able to get this to work with SSH like this:

dagger core git --url git@github.com:levlaz/levlaz.github.io.private.git --ssh-auth-socket ${SSH_AUTH_SOCK} head
edgy estuary
#

There is some policy at my company that we only have https.
I thought saw something related to this with the latest v0.14.0 release that it was suppose to be supported now.

#

My step 2 goal is to load a private dagger module from repo.

restive mortar
#

Yeah you are right sorry - @shy grove do you have an idea?

I get the same error when I do this

dagger core git --url https://github.com/levlaz/levlaz.github.io.private with-auth-token --token=cmd:"gh auth token" head

Log:

dagger core git --url https://github.com/levlaz/levlaz.github.io.private with-auth-token --token=cmd:"gh auth token" head
✔ connect 7.8s
✔ inspecting core types 2.4s
✔ parsing command line arguments 0.2s
✔ setSecret(name: "6f9e1fcf9e06adc32be3ee6a66bc6e5d899cfb0fb32b12b55320cff9507e29d7"): Secret! 0.0s
✔ git(url: "https://github.com/levlaz/levlaz.github.io.private"): GitRepository! 0.3s
✔ GitRepository.withAuthToken(
    token: ✔ setSecret(name: "6f9e1fcf9e06adc32be3ee6a66bc6e5d899cfb0fb32b12b55320cff9507e29d7"): Secret! 0.0s
  ): GitRepository! 0.0s
✔ GitRepository.head: GitRef! 0.0s
✘ GitRef.commit: String! 0.2s
! failed to load cache key: error fetching default branch for repository https://github.com/levlaz/levlaz.github.io.private: git error: exit status 128
  ✘ cache request: git://github.com/levlaz/levlaz.github.io.private 0.2s
  ! error fetching default branch for repository https://github.com/levlaz/levlaz.github.io.private: git error: exit status 128

Full trace at https://dagger.cloud/levs-test-org/traces/200ed72daf131c418bc75b9716f650df

Error: response from query: input: git.withAuthToken.withAuthToken.head.commit resolve: failed to load cache key: error fetching default branch for repository https://github.com/levlaz/levlaz.github.io.private: git error: exit status 128
stderr:
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/levlaz/levlaz.github.io.private/'
shy grove
shy grove
#

Are you connected on your git config ? Do you have a git credential setup ? If you do gh auth login then retry to load the module without the with-auth-token part ?

restive mortar
#

Yeah I am around one sec

shy grove
#

And if gh auth login does not work, then gh auth setup-git should update your ~/.gitconfig, probably as such:

[init]
    defaultBranch = main
[credential "https://github.com"]
    helper =
    helper = !/opt/homebrew/bin/gh auth git-credential
#

The auth token does not have to be specifically requested ; the engine asks your git CLI for the proper password to the credential manager by implyingn it from the ref: github.com for the host, levlaz/levlaz.github.io.private

restive mortar
#

@shy grove are you able to meet me in dev-audio

shy grove
#

yup

restive mortar
#

Ok @edgy estuary thanks for the bug report - we were able to reproduce, we think there is some issue here.

I was able to get this to work using this approach

  1. Run gh auth setup-git (assume you have the gh CLI installed)
  2. Then run dagger core git --url https://github.com/levlaz/levlaz.github.io.private.git head (replace with your repo)

Can you try that and let me know if it works?

edgy estuary
#

@restive mortar It works I did just not realize that I needed to put in anything after the git thing.
With head it works without head it fails.