Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am honestly not sure how else to phrase the question but here is a better explanation.

We have a Git server at work with all our projects. Now obviously I have pulled these repositories onto my desktop machine at work. However, I can pull the repositories from my desktop machine at work to my home PC via a VPN connection.

When I finish working on something at home, I would like to push to my Desktop machine at work and not directly to the main server yet. How do I setup my work desktop machine so that I can push to it from home.

Currently when I try push to my work machine from home I get the following error:

git push remoteName branchName
fatal: 'remotePath' does not appear to be a git repository

share|improve this question
    
It would be helpful to know the URL you used for the remote. – grawity Sep 22 '11 at 20:23
up vote 3 down vote accepted

Make sure remotePath points to an existing Git repository. Use git init to create one.

workpc$ mkdir ~/git
workpc$ git init --bare ~/git/myproject.git

homepc$ git remote add workpc username@workpc.example.net:git/myproject.git
homepc$ git push workpc master

Notes:

  • Do not push directly into a checked-out branch.

    • Most people push into a separate, 'bare' repository (as in the example), and do all editing on clones of it. (Yes, even if on the same machine.)

    • Or you can push into a separate branch with git push workpc master:fromhome, then at work git merge fromhome.

  • It is customary to append ".git" to bare repository names, like I did in the example above, but it's not a requirement.

share|improve this answer
    
You've pointed out something I have not done before, usually I just specify 'git init', I have never specified whether it should be --bare and I have never actually named a repository! Going to give that a go! Thanks! – StevenMcD Sep 22 '11 at 20:28
1  
@FailBoy: The differences are very minor: init gives you a working-tree and a .git subdirectory with Git data, and init --bare puts all Git data directly into the repository, without a working-tree. The latter is intended for "remotes", which you push to, pull from, but never edit directly. Similarly, giving a repository name to init does nothing more than create a new directory by that name, just like mkdir would. – grawity Sep 22 '11 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .