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 6357511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:10:47+00:00 2026-05-24T23:10:47+00:00

I need to git push to remote, and that push need to be current

  • 0

I need to git push to remote, and that push need to be current working copy. Because, pushed source is a web host. So, pushed files need to be currently in use. I am sure no one will edit files at the host 🙂

This question is follow up of these 2 questions,
Is it possible to have a git repo inside another git repo and what difference does –bare switch make when initing a git repo?

Edit: bare repo is not what I want, since files need to be directly used on remote machine, and need to be found on the locations where I put them.

Edit2: It is my understanding that bare repo doesn’t keep the file hieararchy, and keep repo data in root directory

  • 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-24T23:10:49+00:00Added an answer on May 24, 2026 at 11:10 pm

    Here is a step-by-step on how to create a git repo on your web host that will allow direct pushes, set it up as a remote for your local repo, and push changes to it. Note that you need to have ssh access to your web host, and have git installed.

    On your web host (ssh’d in):

    # create an empty repo on  your web host; note its path
    mkdir site
    cd site
    git init
    
    # configure it to allow pushes to the current checked-out branch
    # without complaining (direct push)
    git config receive.denyCurrentBranch ignore
    

    Now with your local repo (run these git commands inside the repo):

    # create the reference to the web host remote for pushing
    # /path/to/the/repo is the path to the repo you made above on the web host:
    # it will be an absolute path OR relative to your ssh chroot (depends on the host)
    git remote add deploy ssh://your_user@your_host/path/to/the/repo
    
    # finally, push your changes!
    git push deploy master
    

    Now, your changes have been pushed to the checked-out repo on the web host. However, they will not be reflected in the working dir (that is, your changes will not take effect immediately). This is because you have pushed directly to the active branch. To finish up, you need to either

    • manually perform a git checkout -f to update the working dir
    • make a git post-receive hook to do it automatically.

    To have instant, automatic deployment with a post-receive hook check out this git site deployment howto.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on ClearCase and now migrating to GIT. But we need
I need to recover two Git branches that I somehow deleted during a push.
How can I set up remote directories in Git where I can locally push
The Problem I need to push changes from an SVN server to a remote
I have a local Git repo that I would like to push to a
I have a GIT repository that I manage for my office. Because of company
So I'm using GIT, trying to push code to my remote server. on a
I have a big problem with git-svn: I need to just push my git
I'm using Linonde to host my git repos and also the actual site files.
I need help getting git extensions to run with msysgit. I have had bad

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.