tags:

views:

78

answers:

1

(1) I have a non-empty directory (eg /etc/something) with files that cannot be renamed, moved, or deleted.

(2) I want to check this directory into git in place.

(3) I want to be able to push the state of this repository to a remote repository (on another machine) using "git push" or something similar.

This is trivial using Subversion (currently we do it using Subversion) using:

svn mkdir <url> -m <msg>
cd <localdir>
svn co <url> .
svn add <files etc>
svn commit -m <msg>

What is the git equivalent?

Can I "git clone" into an empty directory and simply move the .git directory and have everything work?

Thanx,

-H-

+3  A: 

Given you've set up a git daemon on <url> and an empty repository:

cd <localdir>
git init
git add .
git commit -m 'message'
git remote add origin <url>
git push origin master
abyx
**abyx's** instructions appears to work. Do I now run:`git config branch.master.remote origin` and`git config branch.master.merge refs/heads/master`and what I will end up with will be exactly thesame as if I cloned the remote repository?ie `git pull` and `git push` will *just work*?
HMW
@HMW Indeed, that's just it!
abyx