threads / discuss / 27804

Coming from SVN world - need help

Subject: Coming from SVN world - need help

## tl;dr

4 messages between Jul 13, 2011 and Jul 14, 2011.

replies: 3people: 3as markdown or json

J. Bakshi· Jul 13, 2011, 13:00 UTC · lore
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· Jul 13, 2011, 13:17 UTC · re: J. Bakshi · lore

Re: Coming from SVN world - need help

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.

Show 6 quoted lines
> [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· Jul 14, 2011, 05:33 UTC · re: Erik Faye-Lund · lore

Re: Coming from SVN world - need help

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

Show 8 quoted lines
> 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· Jul 14, 2011, 06:08 UTC · re: J. Bakshi · lore

Re: Coming from SVN world - need help

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

← back to recent threads