koppen / redmine_github_hook

Allow your Redmine installation to be notified when changes have been pushed to a Github repository.
http://mentalized.net/journal/2009/08/03/redmine_plugin_github_hook/
MIT License
478 stars 114 forks source link

"Could not create directory '/home/SYSTEM/.ssh" Error on request #80

Closed Solnake closed 7 years ago

Solnake commented 8 years ago

Remine 3.2 installed and works in Windows Server. On request this error happens:

" GithubHook: Executing command: 'git fetch origin'"," GithubHook: Command 'git fetch origin' didn't exit properly. Full output: [\"Could not create directory '/home/SYSTEM/.ssh'.\n\", \"Host key verification failed.\n\", \"fatal: Could not read from remote repository.\n\", \"\n\", \"Please make sure you have the correct access rights\n\", \"and the repository exists.\n\"]"," GithubHook: Redmine repository updated: trivaeocloud_git (Git: 1453.1ms, Redmine: 31.3ms)"]

ssh key is located in .ssh folder in Documents folder. According error message I think that the plugin expects that it works in Linux or Unix system, not windows. Is it possible to make it works in Windows too?

Thanks

koppen commented 8 years ago

I don't know how Windows deals with SSH and Git, but looking at the log it seems the issue is that whatever user you're running Redmine as can't fetch from the remote repository.

The user you're running Redmine as needs permissions to do the following things:

This means you need to add its SSH keys on GitHub. If the user doesn't already have an SSH key, generate one and add the public SSH key as a Deploy Key for the repository on GitHub (or as one of your own keys, if you prefer that).

Furthermore, the user running Redmine needs permissions to read and write to the local repository on the server.

The line that strikes me the most from the log is

Could not create directory '/home/SYSTEM/.ssh

That doesn't seem to match your description of the SSH key being in a Documents folder.

Solnake commented 8 years ago

Thank you for quick response. But everything is correct with SSH key. I can execute command "git fetch origin" from console.

In Windows system when install git - all ssh keys are stored in "C:\Users.ssh" folder (sorry, I was wrong with Documents folder). Windows doesn't have anything what looks like /home/SYSTEM/.ssh.

Maybe if I try to work over HTTPS the issue with ssh key will not happens?

Solnake commented 8 years ago

Changed remote url to https, stored user name and password into credential.helper - everything works in console but when webhook sends a request - I see next response: [" GithubHook: Executing command: 'git fetch origin'"," GithubHook: Command 'git fetch origin' didn't exit properly. Full output: [\"bash: /dev/tty: No such device or address\n\", \"error: failed to execute prompt script (exit code 1)\n\", \"fatal: could not read Username for 'https://github.com': Invalid argument\n\"]"," GithubHook: Redmine repository updated: trivaeocloud_git (Git: 609.4ms, Redmine: 15.6ms)"]

koppen commented 8 years ago

All the error messages are coming from Git:

Could not create directory '/home/SYSTEM/.ssh'. Host key verification failed. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

When you say you can execute git fetch origin do you mean when logged in as your user, or are you running it as whatever user you're running Redmine as? If you run Redmine via IIS or some other system, you might be running as a different user than your own.

Maybe if I try to work over HTTPS the issue with ssh key will not happens?

That is quite likely, definitely worth a shot.

Solnake commented 8 years ago

Yes, you are right - maybe the main issue that I'm working as me and redmine works as another user. Maybe this is a reason of the issue with https remote url too. Ok. will try to make redmine works as me too. Thank you for your help.

koppen commented 7 years ago

Closing due to inactivity, assuming this has been fixed. Feel free to reopen with additional details if not.