Reputation: 140
Having done quite some reading on how to set up GIT (also considered other VCS's) I still have trouble figuring out how to do it for my situation.
I am single developer, working on multiple projects in Delphi under Windows. I have two PC's on which I develop (desktop & laptop) and a Windows 2016 server. Ideally I would like to have central repositories on the server and then push/pull from/to either development PC (as if there are two developers).
The purpose of the remote repositories on the server is to have a single location that I can include in my daily backups.
I came across this article which appears to be a very simple and straightforward approach. However, it still leaves me with some questions:
Hopefully it's acceptable to have multiple (related) questions in a single post. Any guidance or links to applicable/useful resources for this setup will be highly appreciated.
Upvotes: 1
Views: 2632
Reputation: 821
In the link you have provided windows filesharing is used and your central repositories are just folders on a fileshare (e.g. \\server\repos
). So it is like working with repos on your local machines. But I do not know how good git and the smb protocol work together. You may run into problems on simultaneous access to a repo.
You can create your bare repositories on the server simply by doing the following from one of your clients in a git-bash (assuming your share on the server is called repos
).
$ cd //server/repos
$ mkdir ProjA.git
$ cd ProjA.git
$ git --bare init
It is by convention that a bare repository ends with .git
.
To prepare a project on your client-machine, create an appropriate .gitignore
file (find one on https://github.com/github/gitignore), start a git-bash and change into the projects root folder
$ cd /d/Projects/ProjA
$ git init
$ git remote add origin //server/repos/ProjA.git
$ git add .
$ git commit -m "first commit"
$ git push origin master
Now your branch master
from project ProjA
is pushed to the repo ProjA.git
on the server. The branchname master
is by convention the default branch in git.
To clone a repo from the server on one of your clients using a git-bash:
$ git clone //server/repos/ProjA.git
...would backing up this folder be sufficient to have a full backup of the projects? Everything stored in the bare repo wil be backed up. But I am not an expert here.
... exclude "unwanted" Delphi files? Use .gitignore
. You can find some on https://github.com/github/gitignore.
Upvotes: 2