How to upload commits to forked repository in src.fedoraproject.org?

I’d like to make a pull request for a certain package in Fedora. (Note that I’m not in packager FAS group.)

According to How to git push branch back to src.fedoraproject.org repo, it seems that I can’t use SSH authentication.

Are there any ways to commit to the forked repository in src.fedoraproject.org? Or should I create patches and attach to Red Hat Bugzilla?

The post which you linked describes how to do it (and links to a longer description.). Have you tried anonymous clone and push?

The only difference is the remote url which it creates. Normal clone of a fork:

url = ssh://mjg@pkgs.fedoraproject.org/forks/mjg/rpms/mupdf

“anonymous” clone of a fork:

url = https://src.fedoraproject.org/forks/mjg/rpms/mupdf.git
1 Like

Here’s the relevant documentation:

1 Like

Aha, I got it. I correctly set up the remote url, and the issue was the authentication. After clone using fedpkg clone --anonymous and comparing the .git/config file with the one of a normal clone, I found that the only difference was the credential helper.

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

After adding this to the config file of the normal clone, I was able to push to the fork. Thanks for the help!

2 Likes

Thank you for sharing this solution! :blush:

I initially overlooked the official documentation and attempted to fork, modify, commit and push code using standard git. As a result, I faced persistent authentication failures when trying to push my commits to my fork on src.fedoraproject.org, even after correctly configuring my API tokens and SSH keys.

However, after inserting the snippet you provided into path/to/my_repo/.git/config, I was finally able to successfully run git push --set-upstream origin name_of_branch.

For others who might encounter similar issues, running git remote -v on my local cloned fork returned:

origin	https://src.fedoraproject.org/forks/kernelghost/rpms/my_repo.git (fetch)
origin	https://src.fedoraproject.org/forks/kernelghost/rpms/my_repo.git (push)

Once the snippet was inserted, the authentication process involved signing into my Fedora account via a pop-up browser window, after which (I assume) a token was shared with the git instance to facilitate authentication for pushing to my fork.

Thanks once again for your helpful solution!

1 Like