# Coming from SVN world - need help

4 messages from 2011-07-13 to 2011-07-14. Participants: J. Bakshi, Erik Faye-Lund, Ramkumar Ramachandra.
Thread: https://gitlist.dev/t/27804

## J. Bakshi, 2011-07-13 13:00

Subject: Coming from SVN world - need help
Message-ID: <20110713183056.1cde5b61@shiva.selfip.org>
URL: https://gitlist.dev/e/20110713183056.1cde5b61%40shiva.selfip.org

```
Dear list,

Greetings !!

I have come from SVN world and totally new to GIT. I have managed to set gitweb and git; based on https:// along with authentication ( both for read and right ). And now I like to do the rest of the svn related thing in GIT. Just see the script below. This script first create an empty repo, built the structure; then checkout in a directory to map trunk with it and add contents to the repo.

ˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋ`
svnadmin create ${svn_path}/<repo>

svn mkdir file:///${svn_path}/<repo>/trunk  \
         file:///${svn_path}/<repo>/tags  \
         file:///${svn_path}/<repo>/branches \
         -m "creating repo structure"

# map a directory with trunk 

cd mydir
mydir $> svn --username ${admin_svn} --password ${admin_svn_pass} co  file:///${svn_path}/${name_site}/trunk ./

#add and commit
mydir $> svn  add dir1 dir2

##commit
mydir $> svn  commit -m "adding dir1  dir2"
mydir $> svn up
ˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋˋ``

And now the issues when I am trying to do the same with git

[1] git init ${git_path}/<repo>.git  >>> ok , it is working

[2] Problem with mapping a dir with this repo

mydir $> git --username <username> --password <password> clone file:///${git_path}/<repo>.git 

Not working --username and --password .

Also git clone file:///${git_path}/<repo>.git creates a folder <repo>.git where I like map  the working directory with the contents of <repo>.git

[3] git commit -m also not commit into master.

Could any one please give me some clue ?

Thanks

```

## Erik Faye-Lund, 2011-07-13 13:17

Subject: Re: Coming from SVN world - need help
Message-ID: <CABPQNSa1PO6je+4sXMRWLLwLG9sUNTD1a+SMJj=wdPF+_dUPHA@mail.gmail.com>
URL: https://gitlist.dev/e/CABPQNSa1PO6je%2B4sXMRWLLwLG9sUNTD1a%2BSMJj%3DwdPF%2B_dUPHA%40mail.gmail.com
In-Reply-To: <20110713183056.1cde5b61@shiva.selfip.org>

```
On Wed, Jul 13, 2011 at 3:00 PM, J. Bakshi <joydeep@infoservices.in> wrote:
> And now the issues when I am trying to do the same with git
>
> [1] git init ${git_path}/<repo>.git  >>> ok , it is working

You probably want to add the "--bare"-flag if this is the repo that
will be published.

> [2] Problem with mapping a dir with this repo
>
> mydir $> git --username <username> --password <password> clone file:///${git_path}/<repo>.git
>
> Not working --username and --password .
>

You don't need username and password to clone over the file-system,
just the correct file-system permissions.

> [3] git commit -m also not commit into master.

git commit -m"foo" commits into the local branch that HEAD points to
(should be 'master' by default). You need to do "git push" to update
the published repo.

```

## J. Bakshi, 2011-07-14 05:33

Subject: Re: Coming from SVN world - need help
Message-ID: <20110714110318.7726251c@shiva.selfip.org>
URL: https://gitlist.dev/e/20110714110318.7726251c%40shiva.selfip.org
In-Reply-To: <CABPQNSa1PO6je+4sXMRWLLwLG9sUNTD1a+SMJj=wdPF+_dUPHA@mail.gmail.com>

```
On Wed, 13 Jul 2011 15:17:36 +0200
Erik Faye-Lund <kusmabite@gmail.com> wrote:

> On Wed, Jul 13, 2011 at 3:00 PM, J. Bakshi <joydeep@infoservices.in> wrote:
> > And now the issues when I am trying to do the same with git
> >
> > [1] git init ${git_path}/<repo>.git  >>> ok , it is working
> 
> You probably want to add the "--bare"-flag if this is the repo that
> will be published.
> 
Actually the practical scenario is different than just a bare repo. The repos should be connected with its working copy located at htdocs directory. So whenever someone commit anything in git the corresponding working directory should be updated accordingly with a post-commit hook. I have done the same in svn but don't know how git will help to achieve this ? The main part, How can I simply map the folder in htdocs with it's master in git repo ? As "git clone" actually creates the parent folder. In svn it was easy with

ˋˋˋˋˋˋˋˋˋˋˋˋ
cd mydir
mydir $> svn --username ${admin_svn} --password ${admin_svn_pass} co  file:///${svn_path}/${name_site}/trunk ./
ˋˋˋˋˋˋˋˋˋˋˋˋ``

How can I achieve the same in git ?

```

## Ramkumar Ramachandra, 2011-07-14 06:08

Subject: Re: Coming from SVN world - need help
Message-ID: <CALkWK0nboCCGWhcKMgv6Y4FWgfsdhatEf78sSQCAMcKe2HU0FA@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0nboCCGWhcKMgv6Y4FWgfsdhatEf78sSQCAMcKe2HU0FA%40mail.gmail.com
In-Reply-To: <20110714110318.7726251c@shiva.selfip.org>

```
Hi Bakshi,

J. Bakshi writes:
> Actually the practical scenario is different than just a bare repo. The repos should be connected with its working copy located at htdocs directory. So whenever someone commit anything in git the corresponding working directory should be updated accordingly with a post-commit hook. I have done the same in svn but don't know how git will help to achieve this ? The main part, How can I simply map the folder in htdocs with it's master in git repo ? As "git clone" actually creates the parent folder. In svn it was easy with

In the bare repo, set core.worktree to the htdocs directory*, and put
something like this in your hooks/post-receive:
#!/bin/sh
git checkout -f

* For more, read about detached worktrees in Git

-- Ram

```
