Creating a network shared Git source control workflow on Windows 8
How to set up Git for a home network
This post is mainly for my reference but in case someone sees it I hope it is helpful. The source links are referenced for more information and to credit the original authors of this technique.
(Assumes Git is installed correctly for Windows 8)
1. Create a local directory for source code
- something like "C:\code\"
2. Open a command prompt from the new local folder
- Right click on the folder while holding down the shift key and "Open Command Prompt Here"
3. At the client folder path, type "pushd //networkdrivefolder/sourceCode/", where the path is one level above where you will create the origin folder.
- "pushd" will map a network drive to the network share location.
4. At the network drive folder path, type "mkdir repo", where repo is the name of the folder.
5. At the network drive folder path, type "cd repo".
6. At the network drive folder path, now showing the repo folder, type "git init".
- This will create an empty master branch.
7. Create a new file, type "touch readme".
8. Add the file to the repository, type "git add *".
9. Commit the file to the repository, type "git commit -a -m "first commit".
10. Create a separate branch from master to work in, type "git branch dev", where dev is the name given to the branch
11. Type "popd" in the command prompt to return to the local directory.
- "popd" will navigate back and will remove the network share the pushd command created above.
12. Type "git.exe clone --progress -v '//networkdrivefolder/sourceCode/repo' 'C:\code\repo'" at the command prompt to clone the network share repo to a local folder named repo.
13. At the local directory folder path, type "git branch dev", where dev is the branch name created above.
14. At the local directory folder path, type "git checkout dev" to pull files from the network repo.
At this point, you have a full working copy of the git repo on your machine in which you have created and started work in the dev branch.