diff --git a/views/cli.erb b/views/cli.erb index 5a47cdee..d326e868 100644 --- a/views/cli.erb +++ b/views/cli.erb @@ -55,5 +55,23 @@ Subcommands: sudo apt-get install ruby-full A full list of available install options for ruby is here. + + +

Git Hooks

+ +

+ If you want to create a git hook to automatically upload your site to Neocities when you run "git push", you can + run this command in the root directory of your git repo: +

+ +
printf '#!/bin/sh\nneocities push .' >.git/hooks/pre-push && \
+chmod u+x .git/hooks/pre-push
+ +

If the files you're pushing are in a subdirectory of the root git repo, replace the "." with the subdirectory. For example, with Jekyll (which typically uses _site):

+ +
printf '#!/bin/sh\nneocities push _site' >.git/hooks/pre-push && \
+chmod u+x .git/hooks/pre-push
+ +

Note: You will need to be logged in for the git hook to work, so run "neocities push" on the directory you want to upload before installing this hook. This will be fixed in a later version of the CLI.