Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 580005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:25:36+00:00 2026-05-13T14:25:36+00:00

I’m using git to manage a grails project I have. I set up a

  • 0

I’m using git to manage a grails project I have. I set up a git repository on a remote server and what I want to do is when I have code working locally, I want to commit it and push to the remote server. I want the updated groovy file and gsp’s to be put into the right spot on the remote server so that grails will pick up the changes for remote testing. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T14:25:36+00:00Added an answer on May 13, 2026 at 2:25 pm

    If you are pushing to a remote repo, where “it only seems to contain a large pack file, no actual source code” (as you detail in the comments), that should mean “bare repo“, which is good for it allows you to push without any risk of differences between a working tree and the git data.

    Then, as described in “Can I use git to keep a remote server up to date?“, another (non-bare) repo and a post-update hook on the bare repo side will get you where you want.


    The OP TripWired adds:

    Okay so what I did is:

    • create the bare repo for checking in then
    • I created another repo that was standard, basically i have ~/project.git and ~/project.
    • I cloned project.git into project and in project.git/hooks/post-update I put:

      cd ../../project
      env -i git checkout .
      env -i git pull

    I also made sure that post-update was executable.
    When I run the hook from the command line it works fine, but it doesn’t seem to work when I do a check in to the repo.

    I agree with steps 1 and 2, but would then use this script, as in this question.

    Check if it works with a git push from your local repo to your bare repo.

    #!/bin/sh
    #
    # This hook does two things:
    #
    #  1. update the "info" files that allow the list of references to be
    #     queries over dumb transports such as http
    #
    #  2. if this repository looks like it is a non-bare repository, and
    #     the checked-out branch is pushed to, then update the working copy.
    #     This makes "push" function somewhat similarly to darcs and bzr.
    #
    # To enable this hook, make this file executable by "chmod +x post-update".
    
    git-update-server-info
    
    is_bare=$(git-config --get --bool core.bare)
    
    if [ -z "$is_bare" ]
    then
        # for compatibility's sake, guess
        git_dir_full=$(cd $GIT_DIR; pwd)
        case $git_dir_full in */.git) is_bare=false;; *) is_bare=true;; esac
    fi
    
    update_wc() {
        ref=$1
        echo "Push to checked out branch $ref" >&2
        if [ ! -f $GIT_DIR/logs/HEAD ]
        then
            echo "E:push to non-bare repository requires a HEAD reflog" >&2
            exit 1
        fi
        if (cd $GIT_WORK_TREE; git-diff-files -q --exit-code >/dev/null)
        then
            wc_dirty=0
        else
            echo "W:unstaged changes found in working copy" >&2
            wc_dirty=1
            desc="working copy"
        fi
        if git diff-index --cached HEAD@{1} >/dev/null
        then
            index_dirty=0
        else
            echo "W:uncommitted, staged changes found" >&2
            index_dirty=1
            if [ -n "$desc" ]
            then
                desc="$desc and index"
            else
                desc="index"
            fi
        fi
        if [ "$wc_dirty" -ne 0 -o "$index_dirty" -ne 0 ]
        then
            new=$(git rev-parse HEAD)
            echo "W:stashing dirty $desc - see git-stash(1)" >&2
            ( trap 'echo trapped $$; git symbolic-ref HEAD "'"$ref"'"' 2 3 13 15 ERR EXIT
            git-update-ref --no-deref HEAD HEAD@{1}
            cd $GIT_WORK_TREE
            git stash save "dirty $desc before update to $new";
            git-symbolic-ref HEAD "$ref"
            )
        fi
    
        # eye candy - show the WC updates :)
        echo "Updating working copy" >&2
        (cd $GIT_WORK_TREE
        git-diff-index -R --name-status HEAD >&2
        git-reset --hard HEAD)
    }
    
    if [ "$is_bare" = "false" ]
    then
        active_branch=`git-symbolic-ref HEAD`
        export GIT_DIR=$(cd $GIT_DIR; pwd)
        GIT_WORK_TREE=${GIT_WORK_TREE-..}
        for ref
        do
            if [ "$ref" = "$active_branch" ]
            then
                update_wc $ref
            fi
        done
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 377k
  • Answers 377k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In the Searchable Dictionary example, the suggestions are created by… May 14, 2026 at 8:53 pm
  • Editorial Team
    Editorial Team added an answer I have sample code from one of my apps that… May 14, 2026 at 8:53 pm
  • Editorial Team
    Editorial Team added an answer You could implement an SQLite Virtual File System for your… May 14, 2026 at 8:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.