Monday, November 23, 2015

Quick guide to setup a git repository in Windows.

1.      Install git or portable git your machine.
2.      Create a directory in local machine or in network server to use it as Repository. If you are using local machine for repository skip step 3 & 4.
Ex. D://CodeRepo

3.      If you would like to use remote server (or any other machine other than your PC). Create shared directory in the remote server.
4.      Create a Map directory in local machine pointing to Server.


Now we can access the server using drive T:\\
create directory CodeRepo in drive T.
5.      Launch Git-Bash application
6.      Traverse to T://CodeRepo using command
  cd /T/CodeRepo/

7.      To make this directory as git repository
git init -- bare
      --bare represents we would like to use CodeRepo as just a repository not as a working directory. Working directory is one where we directly create and modify code files. Now CodeRepo acts as central repository.
8.       Create working directory in local machine, I am considering C drive here.
 mkdir /c/CodeWork.

9.      Take a copy of your repository using Clone command. This will create copy of your CodeRepo into CodeWork directory.
git clone /T/CodeRepo/

10.   Make the CodeWork directory as git directory
git init

11.   Mark CodeRepo as your remote reposity using remote add command
git remote add origin /T/CodeRepo


12.   Now our repository and Working directory is ready.


Happy coding :)

No comments:

Post a Comment