How to avoid using 'ssh-add ~/.ssh/id_rsa' for every push to a github repo?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












3















I have to repeatedly enter the following terminal commands in order to be able to push to a remote github repository. If I push to github, and then code some more for the next few hours before pushing again, I have to enter the commands:



eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa


Otherwise I get the following error messages:




>> git push origin master



sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey). fatal: Could not read from remote
repository.



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




What do I have to do so that I will no longer need to keep using ssh-add in order to be able to push? I would have thought that using ssh-add once would have fixed the issue but it seems that isn't the case!










share|improve this question
























  • Hmm, related if not dup: this & this, perhaps even this

    – ilkkachu
    Mar 18 '17 at 13:13







  • 2





    I would rather start with "what are you trying to achieve" and "why do you do what you do?". What is your ssh-agent before you run a new one? What does echo $SSH_AUTH_SOCK print before starting the agent? In what format is your id_rsa key?

    – Jakuje
    Mar 18 '17 at 14:06















3















I have to repeatedly enter the following terminal commands in order to be able to push to a remote github repository. If I push to github, and then code some more for the next few hours before pushing again, I have to enter the commands:



eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa


Otherwise I get the following error messages:




>> git push origin master



sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey). fatal: Could not read from remote
repository.



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




What do I have to do so that I will no longer need to keep using ssh-add in order to be able to push? I would have thought that using ssh-add once would have fixed the issue but it seems that isn't the case!










share|improve this question
























  • Hmm, related if not dup: this & this, perhaps even this

    – ilkkachu
    Mar 18 '17 at 13:13







  • 2





    I would rather start with "what are you trying to achieve" and "why do you do what you do?". What is your ssh-agent before you run a new one? What does echo $SSH_AUTH_SOCK print before starting the agent? In what format is your id_rsa key?

    – Jakuje
    Mar 18 '17 at 14:06













3












3








3


3






I have to repeatedly enter the following terminal commands in order to be able to push to a remote github repository. If I push to github, and then code some more for the next few hours before pushing again, I have to enter the commands:



eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa


Otherwise I get the following error messages:




>> git push origin master



sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey). fatal: Could not read from remote
repository.



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




What do I have to do so that I will no longer need to keep using ssh-add in order to be able to push? I would have thought that using ssh-add once would have fixed the issue but it seems that isn't the case!










share|improve this question
















I have to repeatedly enter the following terminal commands in order to be able to push to a remote github repository. If I push to github, and then code some more for the next few hours before pushing again, I have to enter the commands:



eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa


Otherwise I get the following error messages:




>> git push origin master



sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey). fatal: Could not read from remote
repository.



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




What do I have to do so that I will no longer need to keep using ssh-add in order to be able to push? I would have thought that using ssh-add once would have fixed the issue but it seems that isn't the case!







ssh git gitlab






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 18 '17 at 13:08









Michael Durrant

16.4k45121186




16.4k45121186










asked Mar 18 '17 at 12:57









eurocodereurocoder

1164




1164












  • Hmm, related if not dup: this & this, perhaps even this

    – ilkkachu
    Mar 18 '17 at 13:13







  • 2





    I would rather start with "what are you trying to achieve" and "why do you do what you do?". What is your ssh-agent before you run a new one? What does echo $SSH_AUTH_SOCK print before starting the agent? In what format is your id_rsa key?

    – Jakuje
    Mar 18 '17 at 14:06

















  • Hmm, related if not dup: this & this, perhaps even this

    – ilkkachu
    Mar 18 '17 at 13:13







  • 2





    I would rather start with "what are you trying to achieve" and "why do you do what you do?". What is your ssh-agent before you run a new one? What does echo $SSH_AUTH_SOCK print before starting the agent? In what format is your id_rsa key?

    – Jakuje
    Mar 18 '17 at 14:06
















Hmm, related if not dup: this & this, perhaps even this

– ilkkachu
Mar 18 '17 at 13:13






Hmm, related if not dup: this & this, perhaps even this

– ilkkachu
Mar 18 '17 at 13:13





2




2





I would rather start with "what are you trying to achieve" and "why do you do what you do?". What is your ssh-agent before you run a new one? What does echo $SSH_AUTH_SOCK print before starting the agent? In what format is your id_rsa key?

– Jakuje
Mar 18 '17 at 14:06





I would rather start with "what are you trying to achieve" and "why do you do what you do?". What is your ssh-agent before you run a new one? What does echo $SSH_AUTH_SOCK print before starting the agent? In what format is your id_rsa key?

– Jakuje
Mar 18 '17 at 14:06










1 Answer
1






active

oldest

votes


















0














Add your ssh key file - id_rsa to the directory ~/.ssh/



Use copy or move to place it there rather than the ssh-add



This is the private file that start with:



-----BEGIN RSA PRIVATE KEY-----


If you don't have a private key file, maybe the issue is that your actually need to generate them



  • Open a terminal on your local computer and enter the following: ssh-keygen -t rsa -C "your_email@example.com" ...

  • Just press to accept the default location and file name. ...
    Enter, and re-enter, a passphrase when prompted. ...

  • You're done!

These steps are from https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html






share|improve this answer




















  • 2





    The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

    – Stephen Kitt
    Mar 18 '17 at 13:27











  • Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

    – Michael Durrant
    Mar 18 '17 at 20:52











  • When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

    – Stephen Kitt
    Mar 18 '17 at 20:55











  • Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

    – Michael Durrant
    Mar 19 '17 at 3:17










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f352298%2fhow-to-avoid-using-ssh-add-ssh-id-rsa-for-every-push-to-a-github-repo%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Add your ssh key file - id_rsa to the directory ~/.ssh/



Use copy or move to place it there rather than the ssh-add



This is the private file that start with:



-----BEGIN RSA PRIVATE KEY-----


If you don't have a private key file, maybe the issue is that your actually need to generate them



  • Open a terminal on your local computer and enter the following: ssh-keygen -t rsa -C "your_email@example.com" ...

  • Just press to accept the default location and file name. ...
    Enter, and re-enter, a passphrase when prompted. ...

  • You're done!

These steps are from https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html






share|improve this answer




















  • 2





    The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

    – Stephen Kitt
    Mar 18 '17 at 13:27











  • Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

    – Michael Durrant
    Mar 18 '17 at 20:52











  • When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

    – Stephen Kitt
    Mar 18 '17 at 20:55











  • Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

    – Michael Durrant
    Mar 19 '17 at 3:17















0














Add your ssh key file - id_rsa to the directory ~/.ssh/



Use copy or move to place it there rather than the ssh-add



This is the private file that start with:



-----BEGIN RSA PRIVATE KEY-----


If you don't have a private key file, maybe the issue is that your actually need to generate them



  • Open a terminal on your local computer and enter the following: ssh-keygen -t rsa -C "your_email@example.com" ...

  • Just press to accept the default location and file name. ...
    Enter, and re-enter, a passphrase when prompted. ...

  • You're done!

These steps are from https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html






share|improve this answer




















  • 2





    The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

    – Stephen Kitt
    Mar 18 '17 at 13:27











  • Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

    – Michael Durrant
    Mar 18 '17 at 20:52











  • When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

    – Stephen Kitt
    Mar 18 '17 at 20:55











  • Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

    – Michael Durrant
    Mar 19 '17 at 3:17













0












0








0







Add your ssh key file - id_rsa to the directory ~/.ssh/



Use copy or move to place it there rather than the ssh-add



This is the private file that start with:



-----BEGIN RSA PRIVATE KEY-----


If you don't have a private key file, maybe the issue is that your actually need to generate them



  • Open a terminal on your local computer and enter the following: ssh-keygen -t rsa -C "your_email@example.com" ...

  • Just press to accept the default location and file name. ...
    Enter, and re-enter, a passphrase when prompted. ...

  • You're done!

These steps are from https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html






share|improve this answer















Add your ssh key file - id_rsa to the directory ~/.ssh/



Use copy or move to place it there rather than the ssh-add



This is the private file that start with:



-----BEGIN RSA PRIVATE KEY-----


If you don't have a private key file, maybe the issue is that your actually need to generate them



  • Open a terminal on your local computer and enter the following: ssh-keygen -t rsa -C "your_email@example.com" ...

  • Just press to accept the default location and file name. ...
    Enter, and re-enter, a passphrase when prompted. ...

  • You're done!

These steps are from https://confluence.atlassian.com/bitbucketserver/creating-ssh-keys-776639788.html







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 18 '17 at 13:07

























answered Mar 18 '17 at 13:00









Michael DurrantMichael Durrant

16.4k45121186




16.4k45121186







  • 2





    The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

    – Stephen Kitt
    Mar 18 '17 at 13:27











  • Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

    – Michael Durrant
    Mar 18 '17 at 20:52











  • When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

    – Stephen Kitt
    Mar 18 '17 at 20:55











  • Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

    – Michael Durrant
    Mar 19 '17 at 3:17












  • 2





    The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

    – Stephen Kitt
    Mar 18 '17 at 13:27











  • Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

    – Michael Durrant
    Mar 18 '17 at 20:52











  • When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

    – Stephen Kitt
    Mar 18 '17 at 20:55











  • Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

    – Michael Durrant
    Mar 19 '17 at 3:17







2




2





The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

– Stephen Kitt
Mar 18 '17 at 13:27





The OP mentions ~/.ssh/id_rsa — what makes you think it's missing or invalid?

– Stephen Kitt
Mar 18 '17 at 13:27













Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

– Michael Durrant
Mar 18 '17 at 20:52





Because that is within the context of the ssh-add command. Maybe there's an issue with that is what I thought.

– Michael Durrant
Mar 18 '17 at 20:52













When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

– Stephen Kitt
Mar 18 '17 at 20:55





When the OP does that, the push works, which suggests the ssh-add command worked too. It sounds more like the SSH agent is dying for some reason (or no longer responding on its socket, which happens with GNOME’s keyring daemon on my system).

– Stephen Kitt
Mar 18 '17 at 20:55













Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

– Michael Durrant
Mar 19 '17 at 3:17





Sure @StephenKitt you are correct. My answer is somewhat like a comment, but obviously far too long. It's meant more for the OP to try it as investigative and maybe it'll work or maybe it'll show an error. Maybe not.

– Michael Durrant
Mar 19 '17 at 3:17

















draft saved

draft discarded
















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f352298%2fhow-to-avoid-using-ssh-add-ssh-id-rsa-for-every-push-to-a-github-repo%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown






Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?