A strange "fatal: Could not read from remote repository." with crontab

Tanky Woo

I use git init --bare example.git create git repo in my localhost, user is git.

and I use root to git clone, run every minute with crontab, the command is:

*/1 * * * * git --git-dir=/opt/xxx/.git --work-tree=/opt/xxx pull 1>>/tmp/git.log 2>&1

the output log is:

Permission denied (publickey,keyboard-interactive).

fatal: Could not read from remote repository.

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

Then I try:

 */1 * * * * cd /opt/xxx/ && git pull 1>>/tmp/git2.log 2>&1

But the output is the same.

If I run in command line, all is ok:

Already up-to-date.

I don't know why can't run with crontab?

Magnus Bäck

Agent-based authentication requires that the SSH process has access to the $SSH_AUTH_SOCK environment variable, but that variable won't be set when run via the crontab. You may want to consider switching to a passphrase-less keypair or an anonymous authentication method.

If that's not an option you could write the contents of the $SSH_AUTH_SOCK environment variable (possibly also $SSH_AGENT_PID) to a local file that you can read from your crontab-run script and set the variables so that they're available to SSH.

One last option is to drop the crontab entry and manually start up a shell script that runs as a daemon and periodically performs the pull.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

git: fatal: Could not read from remote repository

From Dev

git Connection abandoned, fatal: Could not read from remote repository

From Dev

GitHub: Permission denied (publickey). fatal: Could not read from remote repository

From Dev

Permission denied (publickey). fatal: Could not read from remote repository

From Dev

CentOS: Git: "fatal: could not read from the remote repository"

From Dev

Git: Permission denied (publickey). fatal: Could not read from remote repository

From Dev

Can't push my code to Heroku: Permission denied <public key> fatal: Could not read from remote repository

From Java

Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes

From Dev

Git Clone : Permission denied (publickey). fatal: Could not read from remote repository

From Java

Can't git push to Bitbucket: Unauthorized - fatal: Could not read from remote repository

From Dev

conq: repository does not exist. fatal: Could not read from remote repository

From Dev

can't pull changes from github - Permission denied (publickey). fatal: Could not read from remote repository

From Dev

GitLab ssh to hostname with local user causes "fatal: Could not read from remote repository"

From Dev

Clone the repository from Codebase Permission denied (publickey). fatal: Could not read from remote repository

From Dev

Rails 4 + Capistrano 3 : fatal: Could not read from remote repository while deploying

From Dev

Error $ git pull --rebase Permission denied (publickey). fatal: Could not read from remote repository

From Dev

GitLab ssh to hostname with local user causes "fatal: Could not read from remote repository"

From Dev

Clone the repository from Codebase Permission denied (publickey). fatal: Could not read from remote repository

From Dev

gitlab: Windows: How to use chmod and fix "Get Permission denied (publickey). fatal: Could not read from remote repository"

From Dev

Git Clone : Permission denied (publickey). fatal: Could not read from remote repository

From Dev

git clone error. Read from socket failed: Connection reset by peer fatal: Could not read from remote repository

From Dev

A strange "fatal: Could not read from remote repository." with crontab

From Dev

crontab formats

From Dev

CronTab - Not Working

From Dev

Crontab will not run?

From Dev

crontab formats

From Dev

Crontab deleted?

From Dev

Usage of '%' in the crontab

From Dev

Crontab and NMCLI

Related Related

  1. 1

    git: fatal: Could not read from remote repository

  2. 2

    git Connection abandoned, fatal: Could not read from remote repository

  3. 3

    GitHub: Permission denied (publickey). fatal: Could not read from remote repository

  4. 4

    Permission denied (publickey). fatal: Could not read from remote repository

  5. 5

    CentOS: Git: "fatal: could not read from the remote repository"

  6. 6

    Git: Permission denied (publickey). fatal: Could not read from remote repository

  7. 7

    Can't push my code to Heroku: Permission denied <public key> fatal: Could not read from remote repository

  8. 8

    Heroku 'Permission denied (publickey) fatal: Could not read from remote repository' woes

  9. 9

    Git Clone : Permission denied (publickey). fatal: Could not read from remote repository

  10. 10

    Can't git push to Bitbucket: Unauthorized - fatal: Could not read from remote repository

  11. 11

    conq: repository does not exist. fatal: Could not read from remote repository

  12. 12

    can't pull changes from github - Permission denied (publickey). fatal: Could not read from remote repository

  13. 13

    GitLab ssh to hostname with local user causes "fatal: Could not read from remote repository"

  14. 14

    Clone the repository from Codebase Permission denied (publickey). fatal: Could not read from remote repository

  15. 15

    Rails 4 + Capistrano 3 : fatal: Could not read from remote repository while deploying

  16. 16

    Error $ git pull --rebase Permission denied (publickey). fatal: Could not read from remote repository

  17. 17

    GitLab ssh to hostname with local user causes "fatal: Could not read from remote repository"

  18. 18

    Clone the repository from Codebase Permission denied (publickey). fatal: Could not read from remote repository

  19. 19

    gitlab: Windows: How to use chmod and fix "Get Permission denied (publickey). fatal: Could not read from remote repository"

  20. 20

    Git Clone : Permission denied (publickey). fatal: Could not read from remote repository

  21. 21

    git clone error. Read from socket failed: Connection reset by peer fatal: Could not read from remote repository

  22. 22

    A strange "fatal: Could not read from remote repository." with crontab

  23. 23

    crontab formats

  24. 24

    CronTab - Not Working

  25. 25

    Crontab will not run?

  26. 26

    crontab formats

  27. 27

    Crontab deleted?

  28. 28

    Usage of '%' in the crontab

  29. 29

    Crontab and NMCLI

HotTag

Archive