-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to use with Git over HTTP #210
Comments
Turns out it's currently possible to use Git over HTTP only via setting the git_base: https://oauth2:${ACCESS_TOKEN}@${CI_SERVER_HOST}/ If you put this under version control and have a pipeline run - envsubst < modulesync.yml | tee modulesync.yml EDIT Alternatively, you can use Background reading:
|
Another trick to remember is that Git can transparently replace URLs for you. For example, to replace $ git config url."https://".insteadOf git://
$ grep url .git/config
url = git://github.com/voxpupuli/modulesync
$ git remote -v
origin https://github.com/voxpupuli/modulesync (fetch)
origin https://github.com/voxpupuli/modulesync (push) So I have some aliases in my [url "https://github.com/"]
insteadOf = "gh:"
[url "[email protected]:"]
pushInsteadOf = "gh:"
[url "https://github.com/"]
insteadOf = "git://github.com/"
[url "[email protected]:"]
pushInsteadOf = "https://github.com/" This also means I can do this: $ git clone gh:voxpupuli/modulesync
Cloning into 'modulesync'...
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 1764 (delta 25), reused 38 (delta 17), pack-reused 1709
Receiving objects: 100% (1764/1764), 389.47 KiB | 5.49 MiB/s, done.
Resolving deltas: 100% (928/928), done.
$ cd modulesync/
$ git remote -v
origin https://github.com/voxpupuli/modulesync (fetch)
origin [email protected]:voxpupuli/modulesync (push) As for the username/password, git credentials is probably a better solution. I think this isn't documented in this project since it's really built into git already. |
Thanks for the hints, @ekohl. That's certainly nice to know. But this isn't really just about knowing Git. ModuleSync, that's my point, currently neither gives a helpful hint when Git fails to authenticate (see above) nor does it offer a safe and convenient way to inject credentials when you need to use Git over HTTP (note the example above that shows that we have to manipulate a configuration file). And even worse, the README mentions absolutely zero about such a case (likely because ModuleSync is rarely used with Git over HTTP with private repos). Ideally,
|
It does but it's called
I don't think it should. If you want to, specify it in the URL or use git-based solutions. It's the unix philosophy: small tools that do their own thing. IMHO modulesync should do less with git, not more. Personally I use modulesync most often with |
Oh yeah, that's true. My mistake! (I corrected the wrong references in the comments above). That works, nice! What I found missing is an environment variable as an alternative to |
Sometimes you can't use Git over SSH in a project, hence you'll use HTTP (e.g. due to network constraints). I'm struggling to get this working, and I can't see any related information in our README.
My
modulesync.yml
looks like this:The repository is private, hence I need to authenticate. It's not 100% clear how to do that properly (not taking hardcoding
https://username:[email protected]/
into consideration). The error I get is this one:Just for the sake of completeness, the setup uses the vshn/modulesync Docker image and roughly this CI configuration on GitLab:
Note that the
GITLAB_BASE_URL
adGITLAB_TOKEN
is really just for creating the merge request (via GitLab's API).Document how this shall be done
Using Git over HTTP is probably possible as an alternative.
If we want to suggest using a token for the normal Git operation we should explain how to do this in the README.
The text was updated successfully, but these errors were encountered: