I am working on a project configured on Windows 7 machine. I am the only developer working on it, so I want to setup a private Git repository on the same machine and want to work by creating git branches. Can anyone let me know how can I create git repository with my current system.
2 Answers
If you haven't yet installed git on your Windows machine, get the latest version from here
You can create a git repository on local machine and clone it on the same machine. But I would suggest you to host your code on server, so there are less chances of loosing your hard-work.
There are many free code hosting sites for Git and some of them also provide private repositories. I use bitbucket for my projects.
There is another option for private repositories which is Git on Dropbox, This answer here will help you with this: using-git-and-dropbox-together-effectively.
If you decide to create a repository only on local machine, then here are the steps,
mkdir /c/GIT
cd /c/GIT/
git init --bare myproject.git
cd /c/xampp/www/myproject/
git init
git add .
git commit -m "first commit"
git remote add origin /c/GIT/myproject.git
git push -u origin master
Now, you can start working on your project in C:\xampp\www\myproject\ folder.
To create and switched to a new branch use,
git checkout -b new_branch
which is shorthand for
git branch new_branch
git checkout new_branch

- 1
- 1

- 655
- 6
- 18
-
cool.. this is working for me but how can i fetch lasted code from origin... i used git fetch origin but it throwing error – Deep123 Dec 23 '14 at 09:28
-
you can use `git pull
` or `git fetch ` depending upon your choice. Check 'Working with the code' section on [Git info] (http://stackoverflow.com/tags/git/info) for more details.
You cannot clone the directory , If you want to create the git repo locally only. In order to create a new git repository use 'git init 'command.

- 424
- 5
- 22
-
and one more thing XAMP server has nothing to do with your git repository or any other operation relating to git – Muhammad Raza Dec 23 '14 at 06:19