This is more a reminder to myself for setting things up quickly but shared knowledge useful to all
Some info to start im undertaking this exercise to keep my projects local on my nas rather than on the cloud and wanted to utilise my NAS as a backup
I will preface this is not an in depth technical blog for large scale practices with branching and the like. This is a way for me to closely mimic my work setup at home with a NAS (Network Attached Storage) to hold the source files and project files and have a working checkout on my pc.
How i plan to use repos is from how i know it from work, creating a repository for every project and having a repo for working files (mostly for artists).
Before listing your tips below, add one last sentence that sums up your paragraph or offers a smooth transition to your listicle.
The plan - Locally hosted locations
NAS Location
/Repos
Working_Files
ProjectA
ProjectB
etc
Local Machine
ProjectA_working
Working_Files
This can be literally anything but this is my example
Install Git and Sourcetree*
I will be using Git with LFS as source files are binary and can get quite large. As well as SourceTree to manage commits and files as i could use Git Bash, but im on a path of least resistance so a nice GUI is my pace for this. Links below to each
SourceTree *there are many ways to interact with git, at home i like SourceTree, at work it has been SVN and Perforce.
Make a 'bare' Repo
With looking into setting it up initially and stumbling through, if you are doing what i am with using NAS as a repo to clone from to your local PC, you need it to be a 'bare' so it is a remote repo.
In your /Repos folder on your NAS open Git Bash
git init --bare 'repositoryName'
This creates a git folder and repo on your NAS (this is not where you work, this is where you pull and push to so it stores everything and doubles like a backup off your pc (I know its not a back up solution but it is on a raid server with backups so in a way it is for me)
There will be a handful of files and folders for Git, you dont need to put anything in here file wise, your local checkout is where you will add and push files from
Just a note on why im going down the 'bare' repo route, you can just make a local repo and commit as you go, i want to have a remote repo so i could use any computer to access and push to it or in case my pc ever fails and corrupts theres a safe place with project files.
Adding safe directory
As a non git expert there is probably a good reason as to why i need to mark a safe directory (lets presume security).
If you try to clone your bare repo before this point you will have an error that says something about 'detected dubious ownership in repository'
I have read theres some blanket ways to cover a whole directory or trust all, as a good nugget i felt this was rash so adding a single safe directory individually is fine. Below is what is needed in Git Bash;
git config --global --add safe.directory 'Z:\Repos\yourRepository.git'
This now lets Sourcetree clone your NAS repo without complaints.
Clone your remoteNas Repo
Now the standard part of life, cloning down the repo to your machine to work on it. For sourcetree is as simple as it can be:
New > Clone Tab
Source Path to your NAS Repo Folder
give it a Path and name locally so you know
Clone
Enable Git LFS (Large File Storage)
I am an artist primarily and files are in binary most the time as well as not small when it comes to 3D files and Photoshop files. so with Git LFS enabled you can fetch modify and push large files easier.(?)
Within SourceTree the option is under:
Repository > GIT LFS > Initialise Repository
A popup will show where you add the file types of things to track .ie
For what i do it is usually *.psd *.blend *.mb *.max
This will create a .gitattributes file to commit
Here is the Git Bash version
Ready to roll
The Repo is at a point where you can use it like a standard work space with commits pushes branches as per usual
Comments