In this article we show you how to configure Git for use on our local network with a fresh repository. This is the setup we use here in the office and it works well for us. This is by no means a detailed guide…
Beginning a new repository will require a central location (remote repository) that the team members can contribute to.
To begin a new repository the following steps should be followed, note this assumes the default master branch is the name of your main development branch and that the remote will be called origin. We often use names such as live, staging and proofing for our principle branches – however for the purposes of this how-to we’ll just focus on one branch.
First create the remote repository on the network drive, don’t forget the folder name should end .git, in a terminal window (or windows command prompt) – use the ‘cd’ command to navigate to this folder and run –
git --bare init
Then create your local repository on your local file system, change to that folder in your terminal and run
You now have your local and remote repository ready to be linked. Once you have made your initial commit you can push your files over the network to your central file server. To do this make sure you have your terminal open on at the correct path on your local machine and run –
git remote add origin [NETWORK PATH TO REMOTE].git
You can now add some files to the folder and make your initial commit and push to the remote using your git-gui of choice (we find sourcetree particularly good, there are many other good options). Whilst we could show the commands here to do that, it’s often quicker and easier to do this from the GUI particularly if you want to organise your project folder with the initial resources and working directories.
Git is a fantastic tool and some things are just quicker and easier from the terminal…
Further reading –
Atlassian very clear and well dressed instructions.
Git-scm.com great resource for beginners and advanced users alike.