Solution to generating and uploading ssh key to github account and your project repository

Hello everyone here, i was finally able to push my code to fedora [[ Overview - fedora-commops/fedora-happiness-packets - Pagure.io]]]]
Here are the steps i followed:

  1. I created an ssh key and added it to ssh-agent.
    To create a key run this command in your terminal
    $ ssh-keygen -t rsa -b 4096 -C “your_email@example.com
    And to add it to ssh-agent run
    $ ssh-add ~/.ssh/id_rsa

2). I added my public key to my git account

. After that i added the same ssh key to my forked repository of fedora, and finally changed my url from the “http url” to “ssh-url” and this can be done in two ways either you do it manually by editting the .gitconfig or use git remote set url “ssh-url”.

3.)Then committed my code and pushed it, but it asks for the password to provide access to the private key since you added it to ssh-agent. you have to enter the right password but for my sake i used “ssh-agent”
That’s how i managed to do it .

For more information on this topic you can visit [[[[Connecting to GitHub with SSH - GitHub Docs]]]].

FWIW you don’t need ssh at all to push to GitHub. You can push to the https URL and then login with your Git credentials, and you can use the libsecret credential helper in order to save them securely.

@refi64, its not that always you have to use ssh-key but when your told to use it when your working on a certain project, that’s the way to go about it. thank you so much

1 Like

I’m confused as to how the fedora-happiness-packets repository, hosted on
Pagure, relates to GitHub.