No option add ssh key to src.fedoraproject.org

I want to submit a pull request to update a package. I’ve changed the .spec file, built and tested the package, and done a git commit.

I’m struggling to add my ssh key to src.fedoraproject.org so I can push my commit to my fork. when I go to https://src.fedoraproject.org/settings#nav-ssh-tab , I don’t see any option to add the ssh key.

What do I need to add my ssh key?
Alternatively, is there a way I can authenticate to push over https?

Add the ssh key to your fedora account.

2 Likes

I also think you will have to agree to the FPCA, and probably be in the packager group to contribute ?!

I recommend following this Pull Request Guide. Making sure you're not a bot! if you are not already a packager. Since PR’s via SSH will not work for you.

2 Likes

Thanks. This helped me.

For the sake of anyone who is reading this in the future: As a non packager, you don’t auth using ssh, instead:

When you create the repo using fedpkg clone, it sets up a git credential helper for your local repo:

% git config credential.helper
/usr/bin/fedpkg gitcred

This then opens a browser window when you do a git push where you can then authenticate.

Thanks Leigh.

While I see this is needed for some fedpkg commands, doing this doesn’t enable you to git push to src.fedoraproject.org.

I have very similar issue and still can’t understand why it doesn’t work as simple as in GitHub.

What I already have/did:

  1. I’ve my Fedora account
  2. I’ve Fedora Project Contributor Agreement already signed
  3. I’ve my ssh-ed25519 key generated and its public part copied into my Fedora account.
  4. I’ve forked the project that I want to contribute into in the src.fedoraproject.org
  5. I cloned the same project locally from its original remote, made my branch based on f43 one and committed with my changes into it.
  6. I’ve added an additional remote and tried to push but it failed.
$ git remote -v
origin  https://src.fedoraproject.org/rpms/cinnamon.git (fetch)
origin  https://src.fedoraproject.org/rpms/cinnamon.git (push)
rosti   ssh://rosti@pkgs.fedoraproject.org/forks/rosti/rpms/cinnamon.git (fetch)
rosti   ssh://rosti@pkgs.fedoraproject.org/forks/rosti/rpms/cinnamon.git (push)

And this is according to the Pull Request Guide.

Although it passes the authentication it doesn’t work:

$ git push --set-upstream rosti 6.4.13-1.fc43
Connection closed by 38.145.32.17 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The same error if I try to clone using the same ssh URL inside an empty directory:

$ git clone ssh://rosti@pkgs.fedoraproject.org/forks/rosti/rpms/cinnamon.git
Cloning into 'cinnamon'...
Connection closed by 38.145.32.17 port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

How I know it passes the authentication stage? From following two commands:

$ ssh rosti@pkgs.fedoraproject.org
Connection closed by 38.145.32.17 port 22

$ ssh notme@pkgs.fedoraproject.org
notme@pkgs.fedoraproject.org: Permission denied (publickey).

The same Permission denied (publickey) error is shown when I change my user id inside the ssh url and try either clone or push from the above.

I found that fedpkg support push operation as well but actually it just calls git for doing that. And the Pull Request Guide mentioned above also tells that I can just use git directly to do such a push. Also installing the fedpkg package brings 134 addition dependencies packages, so I didn’t try it yet. There is also fedpkg-minimal package that doesn’t have any dependency and I tried it but it just doesn’t do anything during fedpkg push command and ends silently.

I’ve found another possibility - I can do Remote Pull Request in the original repo and just push my work to GitHub, GitLab or any other external Git repo. I didn’t try it yet but it looks like it will work. However what is the logic of doing it that way? I mean if Fedora Project already granted me an access to its Git repo and allowed me to fork sources of one of the RPM packages inside that repo why I can’t use that repo to push my branch and make a Pull Request without any 3d party resource?

Tricky way of adding an ssh key, no way of pushing/cloning anything to/from user’s fork Git repo. All this looks like Fedora Project reinvented the wheel and “improved” its shape to be square or even triangle. Why Fedora did it so hard and unhandy?

Did you clone the main repo anonymously as noted in the guide?

fedpkg clone --anonymous some-package

Also, as noted above, I dont think people that are not in the packager group can push using ssh/git. I think it’s limited to https only (see the post above).

When you do fedpkg clone --anonymous some-package, it adds the following to the .git/config of the new repo:

[credential]
	helper = /usr/bin/fedpkg gitcred
	useHttpPath = true

With this in place, git push works as normal. I guess you can add the above config manually, I haven’t tried this.

2 Likes

Did you clone the main repo anonymously as noted in the guide?

fedpkg clone --anonymous some-package

I guess it clones it similarely to how I did it:

git clone https://src.fedoraproject.org/rpms/cinnamon.git

Also, as noted above, I dont think people that are not in the packager group can push using ssh/git. I think it’s limited to https only (see the post above).

I’m trying to push into my own repo that is a fork of the original one. I’m not in the packager group and this is ok that I can’t push directly to the original repo. But why I’m restricted in my own repo and can’t push into it? Also I can’t even clone from my repo. If my forked repo is so restricted why I was allowed to create it at all?

When you do fedpkg clone --anonymous some-package, it adds the following to the .git/config of the new repo:

[credential]
	helper = /usr/bin/fedpkg gitcred
	useHttpPath = true

With this in place, git push works as normal. I guess you can add the above config manually, I haven’t tried this.

Thank you Gary, despite the fact that I still had to install that fedpkg with all the 134 dependencies the push finally worked.

I still don’t understand why Git repos of Fedora are so restricted and need a custom 3rd party tools like fedpkg. What is the rationale of fedpkg ? At least for working with forked repo and not with the main repos of the packages, where I don’t have any write rights anyway.

Quote from the sudo dnf install fedpkg log:

Transaction Summary:
 Installing:       135 packages

Total size of inbound packages is 44 MiB. Need to download 44 MiB.
After this operation, 163 MiB extra will be used (install 163 MiB, remove 0 B).
Is this ok [y/N]: y

Did you clone the main repo anonymously as noted in the guide?

fedpkg clone --anonymous some-package

I guess it clones it similarely to how I did it:

git clone https://src.fedoraproject.org/rpms/cinnamon.git

similar, except that it does not setup the authentication so you can
push.

Also, as noted above, I dont think people that are not in the packager group can push using ssh/git. I think it’s limited to https only (see the post above).

That is correct. You cannot push / pull / do anything via ssh if you are
not a packager.

I’m trying to push into my own repo that is a fork of the original one. I’m not in the packager group and this is ok that I can’t push directly to the original repo. But why I’m restricted in my own repo and can’t push into it? Also I can’t even clone from my repo. If my forked repo is so restricted why I was allowed to create it at all?

See Infrastructure/HTTPS-commits - Fedora Project Wiki

If you use fedpkg (as noted above) it will setup the right things to get
you a token so you can push.

You can also do a ‘fedpkg push’ in an existing git repo with a https
remote setup and it will setup the auth / token stuff.