brsbilgic
brsbilgic

Reputation: 11843

Local repository with Git

I would like to use Git in my local computer such that, H:\Projects\projectname will be my server-like repository and I would like work by cloning this repo to C:\Users\xxx\AptanaProjects\projectname

How can I do that ?

Thanks

Upvotes: 1

Views: 1994

Answers (3)

ralphtheninja
ralphtheninja

Reputation: 133188

First you need to create a bare repository on H:. With git you usually name your bare repository with .git, so projectname.git in this case:

h:
cd \Projects\
mkdir projectname.git
cd projectname.git
git init --bare

When this is done you change to c to create your repository:

c:
cd \Users\xxx\AptanaProjects\projectname
git init
git add .
git commit -m "First commit"

After this you need to setup the bare repo on h: as the remote repository so you can push up the code you just commited to the repo on c:

git remote add origin H:\Projects\projectname.git
git push origin master

Now, someone else can clone from H: to get your changes, and their repos will automatically be setup with the repo on H: as their origin.

Upvotes: 2

DreamOfMirrors
DreamOfMirrors

Reputation: 2157

Enter directory C:\Users\xxx\AptanaProjects\projectname and use:

git clone H:\Projects\projectname

or using file protocol file://

Look at http://progit.org/ for free documentation.

Upvotes: 0

Ilkka
Ilkka

Reputation: 2694

  1. Install Git if you haven't already
  2. With e.g. TortoiseGit, initialize a repository in H:\Projects\projectname ("Git create repository here" in the context menu)
  3. Clone that repository to your working directory, e.g. C:\Users\xxx\AptanaProjects\projectname ("Git Clone..." in the context menu)
  4. You're done.

Now when you work, commit in your working directory and then Git Push to send your changes to H:\ Projects.

I'm assuming you have a valid reason for having that projects directory and not just versioning your projects in the working directory?

Upvotes: 1

Related Questions