tried to publish a github repo to opam for the first time. Installing locally on my machine worked, so installed the publish plugin and attempted to publish using these instructions.
Things were going along fine, but I got a permissions error at some point.
$ opam publish
The following will be published:
- subprocess version 0.1 with opam file at
/home/ninjaaron/src/ocaml/subprocess/subprocess.opam
archive at
https://github.com/ninjaaron/ocaml-subprocess/archive/refs/tags/0.1.tar.gz
You will be shown the patch before submitting.
Please confirm the above data. Continue ? [y/n] y
Please generate a Github token at https://github.com/settings/tokens/new to allow access.
The "public_repo" scope is required ("repo" if submitting to a private opam repository).
Please enter your GitHub personal access token:
The token will be stored in ~/.opam/plugins/opam-publish/ocaml%opam-repository.token.
Cloning the package repository, this may take a while...
+ /usr/bin/git "clone" "git@github.com:ocaml/opam-repository.git" "/home/ninjaaron/.opam/plugins/opam-publish/repos/ocaml%opam-repository"
- Cloning into '/home/ninjaaron/.opam/plugins/opam-publish/repos/ocaml%opam-repository'...
- git@github.com: Permission denied (publickey).
- fatal: Could not read from remote repository.
-
- Please make sure you have the correct access rights
- and the repository exists.
[ERROR] Uncaught exception: "/usr/bin/git clone
git@github.com:ocaml/opam-repository.git
/home/ninjaaron/.opam/plugins/opam-publish/repos/ocaml%opam-repository"
exited with code 128
I know how to do PRs in general. I don’t know anything about the specific procedure for contributing to opam.
I’m seeing part of the problem is that I didn’t read the directions after the “If the project is hosted on Github” section because the project is indeed hosted on github.
But reading father, I see I need SSH keys in my github account for this to work (… not sure why this isn’t mentioned in the section about github…)
This is likely the problem. I was just reading the directions up to the point of “if your project is hosted on Github”, but I see that I need ssh keys now that I look at the following section. I’ll try it.
Well, the PR worked. Now I have to fix all the failing tests.
Some fail because it’s being tested against old versions of OCaml without In_channel and Out_channel modules, so I need to figure out how to specify which versions of OCaml are supported, and I’m also failing tests because my tests use ppx_expect, which I haven’t specified as a dependency. I guess I also need to figure out how to specify developement dependencies.
I’ll try to figure it out, but if anyone wants to chime in, I’m generating the opam file from my dune-project file.
edit: figured out the “with-test” dependency thing. edit 2: figured out how to specify compiler version…
I didn’t know it was possible either, good to know. How does that work? Do you have to use the https URL for each project instead of the ssh (git@github.com:...) one?
I’m not sure exactly what you mean, but I think so, yes. I do git add remote origin 'https://github.com/ninjaaron/my_project.git' and this works.
For your ticket, note that the page does say you need an SSH key in github, it’s just in the wrong section. (The one about what to do if the project is not hosted on github)