Using Git for short, simple internal LAN code sharing

Status
Not open for further replies.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
Quite often, developers on our team have short term needs to share code with each other. (NOTE: this has nothing to do with the main code in the primary source control system.)
Examples:
  • Two developers get tasked with a quick proof of concept application they need to collaborate on.
  • A developer is working a large feature that is still unstable and unready to be checked in to the primary repository, but wants to give another developer access in a "playground" completely separate from the main branch. (A short term thing where branching in the primary source control system would be for to cumbersome.)
  • Numerous other scenarios where developers want to share files with the additional functionality of source control. (History, merging, etc.)
Our team uses a combination of GIT and TFS, and want to use GIT inside our internal LAN for these types of small collaborations, and keep the TFS repository for the main source code.

Has anyone used GIT for this type of thing? Suggestions on the easiest way to set this up? (My GIT usage has been limited to either local repositories, or cloud hosted projects (Github, etc.)) Can it be as easy as making a folder on a file share, copying the files in and having git turn that network share into a repository, or would we need more server functionality than just a file share?

We're hoping for this to be a quick, easy, and non-bureaucratic tool for collaborating, so minimizing the effort to create a new shared repository will be key.
 

ShuggyCoUk

Ars Legatus Legionis
10,387
Subscriptor++
[url=http:/civis/viewtopic.php?p=25819043#p25819043:2m52b66x said:
svdsinner[/url]":2m52b66x]Can I assume you mean:
[url=http:/civis/viewtopic.php?p=25818591#p25818591:2m52b66x said:
ShuggyCoUk[/url]":2m52b66x]Just use a file share for the git repository for that scenario. Make sure it's backed up, job done.
Yes, absolutely that's what I meant. I see how it could be unclear :)
 

Jonathon

Ars Legatus Legionis
17,645
Subscriptor
[url=http:/civis/viewtopic.php?p=25820623#p25820623:jlq0y900 said:
chalex[/url]":jlq0y900]So, uh, git just need a directory they have read/write access to. Surely your developers have some kind of directory somewhere that they can do read/write to. So one of them would just do a 'git init' and they're done, right?
'git init --bare' in a location both developers have access to (file share, directory on an SSH server that both users have access to, etc.). Once it's cloned, it behaves just like any other git remote (be it hosted on Github or whatever).

You do want the '--bare'; without it, Git also checks out a working copy and pushing doesn't do what you'd expect if there's a working copy (the repo's not bare).
 

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
[url=http:/civis/viewtopic.php?p=25827499#p25827499:2jxb3619 said:
chaboud[/url]":2jxb3619]Yeah.. just init a share and clone, or use ssh + push/pull to go fully distributed. This is the workflow with git that works. Enterprise-size? There can be issues. Passing code in small groups? Awesome.
Can you elaborate on the part I emphasized above? I'm foggy on how ssh impacts git (beyond connection security) and am foggy about any pull/push alternatives in GIT.

Running summary:
What (currently) I'm seeing as an explicit standard to suggest to our team is:
  1. Identify directory of code you want to share.
  2. Do a local git init on that directory if you haven't already
  3. Go to \\OurServer\OurShare\FolderForTempCode, and make a new directory with a descriptive name for your shared code. (Please remember to toss these temp folders after they are no longer used.)
  4. Do a git init --bare pointing to \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade
  5. Git clone from \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade to your local dir.
  6. Let person you want to share with know the address of \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade
  7. Other person does Git clone from \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade to their own local drive
  8. Enjoy git goodness of sharing.

However, I'm not sure if step 2 is required, a good idea, a bad idea, or "won't work if you do it." Any perspective on if beginning to share an existing local get repository is procedurally different that sharing code not initially in git at all?
 

Jonathon

Ars Legatus Legionis
17,645
Subscriptor
[url=http:/civis/viewtopic.php?p=25872321#p25872321:r400ly4c said:
svdsinner[/url]":r400ly4c]
[url=http:/civis/viewtopic.php?p=25827499#p25827499:r400ly4c said:
chaboud[/url]":r400ly4c]Yeah.. just init a share and clone, or use ssh + push/pull to go fully distributed. This is the workflow with git that works. Enterprise-size? There can be issues. Passing code in small groups? Awesome.
Can you elaborate on the part I emphasized above? I'm foggy on how ssh impacts git (beyond connection security) and am foggy about any pull/push alternatives in GIT.

Running summary:
What (currently) I'm seeing as an explicit standard to suggest to our team is:
  1. Identify directory of code you want to share.
  2. Do a local git init on that directory if you haven't already
  3. Go to \\OurServer\OurShare\FolderForTempCode, and make a new directory with a descriptive name for your shared code. (Please remember to toss these temp folders after they are no longer used.)
  4. Do a git init --bare pointing to \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade
  5. Git clone from \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade to your local dir.
  6. Let person you want to share with know the address of \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade
  7. Other person does Git clone from \\OurServer\OurShare\FolderForTempCode\TheFolderYouJustMade to their own local drive
  8. Enjoy git goodness of sharing.

However, I'm not sure if step 2 is required, a good idea, a bad idea, or "won't work if you do it." Any perspective on if beginning to share an existing local get repository is procedurally different that sharing code not initially in git at all?
The process would look like (I'm assuming you're on Windows and using Msys or Cygwin Git at the command line):

  1. Identify directory of code to be shared
  2. Do a git init on that directory if you haven't already
  3. Add and commit whatever files you want in the repo (don't forget this step! Git isn't psychic)
  4. On your share, create a directory with a descriptive name. Let's call it \\Server\Share\RemoteRepo.git for now. (The .git at the end of the directory name isn't essential, but it is the convention typically used to denote a bare git repository, so you probably want to use it.)
  5. In your shell (Cygwin or Msys git's bash shell), cd to the share and do 'git init --bare'. Now you have a remote repository.
  6. From the directory of your local repository, do 'git remote add origin //Server/Share/RemoteRepo.git'. (You don't want to clone here; cloning creates a new copy of the repository, and you already have a copy of the repo. Also, the change in direction of the slashes here is intentional.)
  7. From the directory of your local repository, do 'git push -u origin master' to push the contents of your local repo's master branch up to the remote, and set up your local repo's master branch to automatically push/pull to/from the remote when you run 'git push' and 'git pull'.
  8. Once that's all complete and you have content in the remote repository, your other team members can get their own local copies of the repository using 'git clone //Server/Share/RemoteRepo.git'
  9. Commit, push, and pull to your heart's content; from here on out everything works just like any other Git repository (be it locally hosted or on something like Github).
 
Status
Not open for further replies.