Server Fault is a question and answer site for system and network administrators. 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'm learning git, and the test case I'm using it for is keeping a repo of my linux profile settings (.bashrc .profile .tmux.conf etc)

on my main machine, the repo is created at the home folder: base=/home/bvector/ files=/home/bvector/.profile, etc

but when I go to clone the repo on machine2, it goes to /home/bvector/home (as the repo is called home) base=/home/bvector/home/ files=/home/bvector/home/.profile, etc

Is there a way to have the cloned repo be based in my home folder with all the files in the correct place by default? Everything I've read says you cant clone a repo to a nonempty directory, which would make it a lot more cumbersome to have the repo on multiple machines and be able to seamlessly commit changes.

share|improve this question
up vote 3 down vote accepted

Github has just launched a set of new pages describing how to use Github for this scenario.

share|improve this answer
this is an amazing resource, and it is so useful I'm going to select it as the answer, even though my answer solved my problem, this is probably the best way to do it – bVector Apr 25 '12 at 1:02

An easy (inelegant?) thing to do would be:

git clone --bare whatever ~/.git

The --bare option tells it to basically checkout the contents of a normal .git directory (so it won't check out a working copy), and put into the directory ~/.git. You can use git checkout <file> to get individual files, or git reset --hard to replace all your existing files with their equivalent in your git repository, if they exist.

share|improve this answer
cd ~
git init
git remote add origin ssh://host/repo.git
git pull origin master

this works for this situation. from

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.