Friday, 10 June 2011

How to Setup Local/Remote Git Repository in Windows

* Prerequisites
- Install Cygwin http://cygwin.com
- Add Cygwin git package

* Create Remote Repository in (/cygdrive/c/repository)
- Got to /cygdrive/c/repository and create folder samplegit.git (/cygdrive/c/repository/samplegit.git)
- Go to that folder and run 'git init --bare'

* Create Local Repository in (/cygdrive/c/projects)
- Got to /cygdrive/c/projects and create folder samplegit (/cygdrive/c/projects/samplegit)
- Create new Project, run 'sbt' or do it in your favourity IDE
- Go to that folder /cygdrive/c/projects/samplegit and run 'git init'
- Associate with remote repository 'git remote add origin /cygdrive/c/repository/samplegit.git'
- Add all files & folders 'git add .'
- Commit to local repository 'git commit -m "initial commit"'
- Push to remote repository 'git push origin master'

* To test if all ok clone it in another location (/cygdrive/c/temp)
- Run 'git clone /cygdrive/c/repository/samplegit.git samplegit'

* To get latest updates
- Run 'git pull origin master'

No comments:

Post a Comment