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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:46:27+00:00 2026-05-13T12:46:27+00:00

What I want to do: On my (ssh remotely accessible) university machine I work

  • 0

What I want to do: On my (ssh remotely accessible) university machine I work on a project which I have put under git source control (git init, then git commit -a after every change, all works fine). Now I want to want to work on that project on my private machine at home. Should be easy, since git is a distributed vcs, right?

I read the git tutorial, which suggests to do a git pull at university to get the changes done at home. That won’t work, since my machine at home is not remotely accessible. So I thought that I’d do a git push at home. That works, but it’s complicated (requires git reset at university afterwards, etc.), since non-bare repositories are not designed for pushing.

Question 1: Is there an easier way than adding a additional bare repository to my setup (which would mean that I had: (1) the “main” bare repository, (2) the university working copy, (3) the home working copy)?
<Rant>If I really need that setup, I could have stayed with SVN.</Rant>

Question 2: If that setup is really needed, how do I create that bare repository (git clone --bare, I guess) and make it the “main” repository, i.e., tell the working copies that git push is supposed to go there.

PS: I know that there’s a post-receive hook floating around that allows you to push into non-bare repositories. I tried it, but it didn’t work well since the git version on the university machine is quite old (1.5.5.6) and misses some commands used by the hook. Updating is not an option, and I’d prefer a solution without third-party scripts anyway.

  • 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-13T12:46:27+00:00Added an answer on May 13, 2026 at 12:46 pm

    You really shouldn’t push to the checked out branch as it effectively pulls the rug from under the remote working copy. It’s then difficult to work out if the working tree is modified because the branch head has moved or if there were also local changes which would be lost by a reset --hard.

    The simplest thing to do is to push to a different branch. You can then merge this into the working copy’s checkout out branch (or rebase the local branch onto it) when you have access to the remote machine and need to work on it.

    From home:

    git push origin HEAD:from-home
    

    From ‘work’:

    git merge from-home
    

    You can set up your config to default to a particular push refspec.

    e.g.

    git config remote.origin.push +master:from-home
    

    A bare repository is often more natural. You can either clone it from an existing repository or, what I usually do, initialize a new repository and push the master branch that I want to it from an existing repository.

    Better still, if you’re going to use working copies at each location, is to use this trick to directly modify the remote’s remotes, rather than a speically renamed branch.

    So, on origin, create a remote called ‘home’ — you obviously can’t fetch from it because of your network configuration. That doesn’t matter.

    On home, tell it, “When I push to origin, have it update the origin’s remote named home:

    git config remote.origin.push +master:home/master
    

    Now, things get really slick. From home, run git push origin, and go to origin, and run git status or git branch -a -v — What you will see is something like: “master is behind home/master by 3 commits and can be fast forwarded.”

    In other words, using home to push a change to origin’s remote named home, is functionally the same as using origin to pull from home.

    The one downside here is that you’ll need to continually do new git config settings as you create additional branches on home. That’s the overhead you pay for your network setup. Thankfully, it’s simple and only happens once per branch create.

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

Sidebar

Related Questions

I have some git repositories accessed remotely through SSH and I want to make
I have been looking at posts discussing SSH tunneling which sounds analogous to what
I want to setup a simple ssh tunnel from a local machine to a
I want to execute source mysite/bin/activate Whever I ssh into that server (and login)
I want to execute a Python script on several (15+) remote machine using SSH.
I have a server with ssh, that I want to use as a central
I want to access my home computer from work through SSH, but the problem
I have a need to restart a CentOS service remotely via ssh during an
I want to create a Ruby script which opens a SSH pseudo-tty-less connection, and
ssh will look for its keys by default in the ~/.ssh folder. I want

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.