0

I'm on a Mac and I'm trying to create a workflow to improve my process.
So I just installed git on my own machine.
What I'm having issue now is how can I create a post-update hook to push changes I made locally to my remote server?
Note: the git server is on my local machine, so it is not accessible from the hosting server
There are a lot of different hooks, is post-update hook even the right hook I should be doing this on?

This is what I have so far, but it is creating an error right now.

# trying to get a list of files that I just pushed to my local git server, but it is failing because apparently 'diff-index' isn't available on the server side of git
files_modified=`git diff-index --name-only HEAD`

for f in $files_modified; do
  # trying to print out the files.
  # the goal here is I'm trying to execute 'scp' to push the files to the server, but please let me know if there is a better solution
  echo f
done

exit

Thank you,
Tee

1 Answer 1

1

Repositories set up to auto-forward pushes can use post-update. I'd be extremely leery of a repo that initiates pushes on its own, because at least rebase and reset do a Jekyll-and-Hyde number on pushed refs, turning from very useful operations into fraught and fragile ones.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.