Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local git repository using Windows 7 with XAMPP server [closed]

Tags:

git

php

windows

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.

like image 957
Deep123 Avatar asked Nov 24 '25 07:11

Deep123


1 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
like image 106
Nikhil Supekar Avatar answered Nov 25 '25 20:11

Nikhil Supekar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!