local mac using network home server as git repo possible?

aaronfischer August 14, 2012

Question regarding... SourceTree and git are installed on the local mac machine, however I am connecting and using network space on a (webDAV or an AFP) home server. I would like to know if bitbucket works better with webDAV or AFP. or if it works at all?

Does git need to truly be installed on the home server for it to work or can the fact that it is acting like a network drive and a local machine powering the git repo that is stored on the network home server suffice? I was testing it out and it gave me an error message, but I tried it via webDAV (via finder) and then committed the changes in SourceTree but they did not show up on bitbucket in my repos, and when I made another change to the file nothing showed up in SourceTree as being changed or needing to be put into the staging.
My ideal setup is... local mac to control the git repos that are located on my home server (which can be accessed anywhere), use the home server as the development version (dev.website.com) and then when everything is developed setup a POST-receive file and every time something is committed to the bitbucket repo it pushes those files over to the live server... (website.com), does this make sense? I just want to understand if this is possible or if I need to change something about my workflow theory.
Thanks,

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2012

git can in theory work over standard network shares, but it is not as reliable that way and I would personally not recommend it. If you want to have a home server with a copy of your repository on it, the easiest way is either to just use SSH (even most shrink-wrapped NAS units like Synology/QNAP support enabling an SSH service), or to use a system like gitosis or gitolite (Google them :)). Synology has a gitosis package you can install via ipkg, and if you have a Linux box it's extremely easy to install. You then just push the commits to this server just like you push to BitBucket over SSH.

About your commits in SourceTree not showing up on BitBucket, remember you have to push your commits before they will appear. Git commits locally, so until you push those commits, they're only on your local machine.

About setting up a post-receive hook on Bitbucket, there's a limited number of scripts you can set up there. You might prefer to do it just by deploying via push to your deployment servers as and when you want to deploy a version. If you want to automate it further, it's probably better to do it on your own server where you have full scripting flexibility.

aaronfischer August 14, 2012

"about your commits in sourcetree not showing up on bitbucket"...

when i connect to the nas via webdav it seems to work (with 1 issue that I'll get to in a second).

However, when I connect to the nas via afp it gives me an error when trying to stage files... (see attached)

AND... when I connect via webdav or afp, i have hidden files that also appear, (see attached). all files will show 2 versions... "._filename.html" and "filename.html"

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2012

Yeah, this is basically the kind of thing I was talking about when using git across network shares, it's generally not a good idea. Git uses filesystem features which aren't always supported via network shares, it's best not to try it. Worst case I've seen is a complete repository corruption because of a SMB share - just use a local repository and push to remotes via the 'proper' routes like SSH/HTTP.

adardesign April 24, 2013

@steve, Thanks!

Any knowledge on the the Lacie 5Big?

1. Is connecting via AFP any better? and can it then be used as a repo and pus as if it was a remote repo?

2. And, what are the limitations on the post-receive hook to push to Bitbucket?

3. Currently (while not even using it as a centeral repo) After doing a git log i often get the "unable to write to index file".

Thanks again!

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2013

I wouldn't recommend using a remote share as a full working copy under any protocol, there's too much potential for weird errors & corruptions because of interruptions, and it's sacrificing a lot of the speed of a DVCS. By all means use them as remotes though, in that case the protocol matters less.

Bitbucket doesn't allow arbitrary post-receive hooks, but it has a lot of options in the service integration section in admin that you can use to trigger pretty much anything. Here's an article you might find useful: http://brandonsummers.name/blog/2012/02/10/using-bitbucket-for-automated-deployments/

0 votes
aaronfischer August 14, 2012

Thanks for a great response.

My home server is a Synology NAS. I'd like to keep the NAS as the development server, that way i can make multiple small changes to my files on the development server without needing to commit every little change to preview in the browser via dev.website.com. I am able to share my development server with clients, for approval purposes. I would not be able to do this on my local machine, also dont want my local machine with 30+ full copies of wordpress, I'd like the NAS to handle these files.

Hmm, I'm at a workflow stand-still trying to wrap my head around what's possible, and more certainly... What's possible in my certain case. For instance In addition I need a solution that allows me to use a GUI interface as I've read up/studied how git works but I can't stand terminal or any command line use.

Things I need:

Use sourcetree (or other git gui) for all git work.
Share development server with client. (clientwebsite.myserver.com)
Something to allow me to take this development version (Without SSH) and push to a live server (clientwebsite.com) so if this means pushing to something like bitbucket that can handle the POST script that would be ideal.

Could you provide any knowledge or suggestions based on this feedback? I feel there are a million workflows that "could" work I'm just not aware of other options. Thanks, Aaron

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2012

If you want to see the files on your local NAS box without committing, I'd suggest using a simple sync approach. You could either do it with rsync, or you could make it happen automatically using Synology's CloudStation: http://www.synology.com/dsm/home_file_sharing_cloud_station.php

For deploying to a client site, I think rsync is likely to be best (even if you don't like the command line, you can figure out the rsync command once and then bind it to a Custom Action in SourceTree so you don't have to think about it). If the client site is only available over WebDAV then maybe use a tool that specifically supports WebDAV file sync, there are a few out there when I searched such as GoodSync.

You can definitely deploy using Git but generally you need the server end to be Git-aware. And of course you have to commit before you can do that so the sync option is better if you want to look at it on your dev server in real time.

aaronfischer August 14, 2012

Very interesting... so for this case I would need git installed on the NAS? The client server "should" always have git capabilities so that shouldn't be a problem.

I could deploy from either the local or the nas since they are synced? If I could deploy from either then I wouldn't technically need git installed on the nas (dev server) because the local machine could do it? So at that point the only condition not met is the "not have 30+ full copies of wordpress installed on my local machine" but I guess if I get a good workflow this can be overlooked. Pretty sure the mac can handle it. ;)

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2012

You don't need Git installed if you're just syncing via rsync or CloudStation. In fact, it would be better to exclude the '.git' subfolder from the sync so you don't clutter the server with the git repo as well as the files if you're just doing a file-based sync.

As for whether you can deploy from the server, it depends how you deploy. If you use Heroku or similar, then you can only deploy from a git repo on a machine that can 'git push'. If you deploy just by uploading files, then you can just rsync or other simple file-based upload from either your local machine or the server.

TAGS
AUG Leaders

Atlassian Community Events