Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commits in GitKraken #18

Closed
Lars- opened this issue Mar 15, 2023 · 7 comments
Closed

Commits in GitKraken #18

Lars- opened this issue Mar 15, 2023 · 7 comments

Comments

@Lars-
Copy link

Lars- commented Mar 15, 2023

First of all: wow it works great in the CLI, this is going to save me a lot of time.

Is it possible to make it work in GitKraken as well? I have set the hook, and it is recognized by the client, but I need to type a commit message before I can click the commit button.
GitKraken then says that the hook exited with error code 127. In the logs I see this: /usr/bin/env 'node': file or folder doesn't exist. When I execute /usr/bin/env node in my terminal it works, so GitKraken seems to have some sort of other context.

I tried changing the first line of the hook to #!/home/lars/.nvm/versions/node/v16.18.1/bin/node (since that is the full path to my node executable). GitKraken then says that the hook executed succesfully, but it didn't change the commit text that I needed to type to be able to click on the commit button...

What to do to fix this? Or what can I do to debug this further?

@Lars-
Copy link
Author

Lars- commented Mar 15, 2023

I actually think that I may have found something already. In /src/commands/prepare-commit-msg-hook.ts on line 18, you check if the commit message is already set and stops the execution if it is. Since I need to type something to actually commit, this would always disable opencommit.

@Lars-
Copy link
Author

Lars- commented Mar 15, 2023

Removing that from the hook and changing the first line to my full node path enabled it. It would be great if line 18 is optional (maybe configurable per project via the cli) and the first line should contain the full path to node to work with GitKraken (maybe globally configurable via the cli)

@Lars-
Copy link
Author

Lars- commented Mar 15, 2023

I created #19 for the configurable line 18 check, but I don't know how to fix the node path error.
It seems that GitKraken doesn't know the environment variables at all, so /usr/bin/env doesn't work there.

@sukharev-deel
Copy link

wow, that's great research! now i see what #19 is about, nice. let me check it one more time

@sukharev-deel
Copy link

sukharev-deel commented Mar 15, 2023

have you tried this https://stackoverflow.com/a/26320915? may solve the 'node': file or folder doesn't exist issue

@Lars-
Copy link
Author

Lars- commented Mar 15, 2023

have you tried this https://stackoverflow.com/a/26320915? may solve the 'node': file or folder doesn't exist issue

I just tried it, but that doesn't work either, since you call /usr/bin/env node. The /usr/bin/env part is the problem. But a workaround that actually works great is to simply change the hook and since it's a symlink, it's automagically changed for all projects, so it works now, but it's a bit of a hacky way haha.

@di-sukharev
Copy link
Owner

di-sukharev commented Mar 17, 2023

@Lars- thats great, could you close the issue pls <3

@Lars- Lars- closed this as completed Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants