点文件的git回购 – 克隆到homefolder

我正在学习git,我使用的testing用例是保存我的linuxconfiguration文件设置(.bashrc .profile .tmux.conf等)

在我的主机上,repo创build在home文件夹中:base = / home / bvector / files = / home / bvector / .profile等

但是当我去克隆machine2上的repo时,它会进入/ home / bvector / home(因为repo被称为home)base = / home / bvector / home / files = / home / bvector / home / .profile等

有没有办法让克隆回购基于我的家庭文件夹默认情况下的所有文件在正确的位置? 我读过的所有东西都说你不能将一个repo克隆到一个非空目录,这将使得在多台机器上安装repo并能够无缝地提交修改变得更加麻烦。

Github刚刚推出了一组描述如何在这种情况下使用Github的新页面。

http://dotfiles.github.com/

一个容易(不雅观?)的事情是:

git clone --bare whatever ~/.git 

--bare选项告诉它基本上检查一个正常的.git目录的内容(所以它不会检出一个工作副本),并把它放到~/.git 。 您可以使用git checkout <file>来获取单个文件,或者使用git reset --hard来replace您的git存储库中的所有现有文件(如果存在的话)。

 cd ~ git init git remote add origin ssh://host/repo.git git pull origin master 

这适用于这种情况。 从https://stackoverflow.com/questions/9443927/git-clone-into-home-directory