I’ve used GitLab for quite some time, and as a full featured CI/CD platform that also provides git functionality … it’s awesome. But it’s also serious overkill for someone who wants to coordinate code with another developer or two. Or just keep history for their code. Or a backup. To accomplish this, all you need is drive space. If you’ve got a file server, any folder on the share can be a git repository.
On the server, create a git repository and add something to it.
Z:\Temp\test>git init Initialized empty Git repository in Z:/Temp/test/.git/ Z:\Temp\test>notepad testfile.txt Z:\Temp\test>git add testfile.txt Z:\Temp\test>git commit -m "Initial file upload" [master (root-commit) 9a3ebe7] Initial file upload 1 file changed, 1 insertion(+) create mode 100644 testfile.txt
Then on your client, either clone the repo from the drive path
C:\Users\lisa>git clone file://z:/temp/test Cloning into 'test'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done.
Or from the UNC path
C:\Users\lisa>git clone file://server01.example.com/data/temp/test Cloning into 'test'... remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done.
I prefer to use the UNC paths – if my drive letter fails to map for some reason, the UNC path is still available.
If you’ve got pre-existing code, there’s a bit of a different process. On the server, create an empty folder and use “git init” to initialize the empty repo. On the client where the code exists, run:
git init git add * git commit -m “Initial code upload” git remote add origin git clone file://server01.example.com/data/temp/test git push origin master