0

I set a ssh-agent and gave it an id_rsa key, so I don't have problem using git command on a terminal of a linux server to update to github, but when I try to do this by a bash script using qsub to submit the job to the server, I got the following error messages,

On branch master

nothing to commit, working directory clean

Permission denied (publickey).

fatal: Could not read from remote repository.

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

my shell script is,

#!/bin/bash git add *.png git commit -m "upload_fig" git push

I also set ~/.ssh/config like the following,

Host remoteHost ForwardAgent yes

Host github HostName github.com User git IdentityFile ~/.ssh/id_rsa

Anyone knows how to solve this issue? Thanks!

In addition: I have set id_rsa key to github and I can use git command on the local terminal.

Ryou
  • 1
  • 1

1 Answers1

1

What you are looking for might be in what you are looking for might be in this. I'm guessing you didn't add your public key, ~/.ssh/id_rsa, to your github account.

PythonicOreo
  • 422
  • 1
  • 4
  • 14
  • I did add my pubic key ~/.ssh/id_rsa, to my github account. So that is why I can use git command to push figures to my github account by a terminal. But my problem is that the git commands in a qsub batch job script doesn't work. – Ryou May 15 '20 at 05:55
  • Did anything else from that question help? – PythonicOreo May 15 '20 at 05:56
  • Thank you so much. But my problem wasn't solved. Do you know how can a batch job to use the key recorded in a ssh-agent so that it can git push? – Ryou May 15 '20 at 06:05