How To Create a Networked Git Repository on Windows From Scratch (in less than 60 seconds)

Seekers,

Everything I found out there to do this was either wrong, had typos, or said it was for a ‘Remote’ (networked) repository, but they were talking about Github, or something else… I wanted at least one post on the Internet to be accurate, and do what it said it was going to do. Here is a nice overview of what Git is/does:

Examples of development flow with Git

If you work alone, or in a very small group, Subversion is awesome. It’s all I’ve ever known-refusing to even learn the antiquated CVS. SVN can do things I’m not aware other software versioning systems can do, like allow you to version MS Office documents and plain text files. There are tons of utilities out there for SVN, too, and it is very nicely integrated into Visual Studio (VisualSVN), and your normal Windows desktop as TortoiseSVN.

Being new to Git, but needing a repository system that was much more ‘release aware’, I put in Git, and immediately found out how difficult it was to find good, correct information on it’s setup & use. This post is the result of that frustration-not just for my reference, but for yours as well… :)

Here we just create a fresh, empty repository on a file share (share location: D:\GitRepos\testRepo, local directory will be C:\Users\Pat\testRepo (filename created when checked out)):

ScreenHunter_14 Apr. 25 10.18

C:\Users\Pat>d:

D:\>cd GitRepos

D:\GitRepos>mkdir testRepo

D:\GitRepos>cd testRepo

D:\GitRepos\testRepo>git init
Initialized empty Git repository in D:/GitRepos/testRepo/.git/

D:\GitRepos\testRepo>touch NewRepository

D:\GitRepos\testRepo>git add *

D:\GitRepos\testRepo>git commit -a -m “First Commit…”
[master (root-commit) 45fac89] First Commit…
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 NewRepository

Next we go back to the directory we want the repo checked out to:

D:\GitRepos\testRepo>c:

C:\Users\Pat>git clone //doozy/gitrepos/testRepo
Cloning into ‘testRepo’…
done.

note: In the above, even though my repo is on the same box as my local checkout, I am showing here the way other users, and myself, can get to it to show you it is, in fact, a network shared repository.

C:\Users\Pat>ls
[…]
testRepo
[…]

C:\Users\Pat>ls -l testRepo
total 0
-rw-rw-rw-  1 Pat 0 0 2014-04-11 17:59 NewRepository <— the file we ‘touched’ earlier

next we will create a branch off of our master, calling it ‘development’. This is the one we will primarily work with, and we will branch/merge to/from this branch to create releases:

C:\Users\Pat>cd testRepo

C:\Users\Pat\testRepo>git branch development

C:\Users\Pat\testRepo>git checkout development
Switched to branch ‘development’

C:\Users\Pat\testRepo>touch inDevelopmentBranch

C:\Users\Pat\testRepo>git commit -a
On branch development
Untracked files:
inDevelopmentBranch <— the file we just created is in the local working dir, but just like in SVN, it has not been ‘added’ to version control

nothing added to commit but untracked files present

C:\Users\Pat\testRepo>git add inDevelopmentBranch

note: You can also do: “git add *” to add all, or any other wildcards…

C:\Users\Pat\testRepo>git commit -a
[development 32a74f0] This is the first commit for the development branch… testRepo is the repository…
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 inDevelopmentBranch

C:\Users\Pat\testRepo>git –version
git version 1.9.0.msysgit.0

Done!


Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Leave a Reply
Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Deprecated: Function get_magic_quotes_gpc() is deprecated in /homepages/16/d105165054/htdocs/atcp.us/blog/wp-includes/formatting.php on line 4819

Your email address will not be published. Required fields are marked *