Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Dromio
Oct 16, 2002
Sleeper
Anyone using gitolite to manage their git repository hosting? I've got a very simple setup where all users have full access to my repository there.

And today one developer managed to do something stupid with their GUI git client and pushed a bunch of code into our master branch right before a deployment. That sucked badly. Now I need to lock it down so only one or two developers can push to the master branch.

I'm having a terrible time figuring out gitolite's configuration syntax. Anyone had any experience with this?

Adbot
ADBOT LOVES YOU

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine

Dromio posted:

Anyone using gitolite to manage their git repository hosting? I've got a very simple setup where all users have full access to my repository there.

And today one developer managed to do something stupid with their GUI git client and pushed a bunch of code into our master branch right before a deployment. That sucked badly. Now I need to lock it down so only one or two developers can push to the master branch.

I'm having a terrible time figuring out gitolite's configuration syntax. Anyone had any experience with this?

Gitolite user here, far from an expert though. But here's an example of what I have set up:

code:
repo    testing
        RW+  = @all

repo    company
        RW+        = golbez otherguy
        RW+ master = golbez
        R   master = otherguy
Now, keep in mind: I've never actually tested this. But, as I expect it to work:
1) Everyone [the "@all" magic word] has read [R], write [W], and destroy [+] access to the testing repository.
2) The other guy and I have RW+ access to the company repository.
3) However, when it comes to the master branch, I only have RW+ permissions; other guy can only read it.

http://sitaramc.github.com/gitolite/conf.html isn't the easiest read but you'll find most of what you need there.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Dromio posted:

And today one developer managed to do something stupid with their GUI git client and pushed a bunch of code into our master branch right before a deployment.
Bullshit, that's not your dev being stupid. That's your devops being stupid and deploying from master instead of a dedicated release branch.

Dromio
Oct 16, 2002
Sleeper

Mithaldu posted:

Bullshit, that's not your dev being stupid. That's your devops being stupid and deploying from master instead of a dedicated release branch.

Ok, so I'm the stupid "DevOps". And the way I build for deployment is I create a new branch off the current production code (master), merge in the branches we want to release, then deploy. After that I merge this deployment branch back into master so it is always up to date.

So yeah, 'master' is the dedicated release branch. In fact we've renamed it to 'Production' here just to drive that point home. The only thing I think I should have done differently to prevent this is take a more carefully look at the master history when I started my latest deployment branch.

How else can I do this better?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Testing the result of merging several branches before pushing to production would be a good first step.

wwb
Aug 17, 2004

That and humans don't deploy code to production. CI servers deploy code to production after the tests run.

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Dromio posted:

How else can I do this better?

Well, first off, step by step, what did happen here:

Dromio posted:

And today one developer managed to do something stupid with their GUI git client and pushed a bunch of code into our master branch right before a deployment.
I ask this because this bit implies you deploy from the release branch, so it should be impossible for a dev pushing into master to affect you:

Dromio posted:

I create a new branch off the current production code (master), merge in the branches we want to release, then deploy.
Your description is unclear.

Dromio posted:

The only thing I think I should have done differently to prevent this is take a more carefully look at the master history when I started my latest deployment branch.
That and as others have said: Run automated tests on your software before deploying it to anything, then deploy it to a staging environment that uses your databases but is not available to the public and only deploy when that all looks right.

Dromio posted:

So yeah, 'master' is the dedicated release branch. In fact we've renamed it to 'Production' here just to drive that point home.
This does not work in the long term. The sustainable path of action is to have master be the timeline of development, off which deployment branches branch off that *never* merge back into anything.

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!

Mithaldu posted:

Bullshit, that's not your dev being stupid. That's your devops being stupid and deploying from master instead of a dedicated release branch.

Depending on your setup, there's nothing wrong with pushing from master. GitHub does it, for instance.

We do it as well, but our "master" is less of a typical mainline, and more of a deployment branch. The only branch that ever gets merged into master is development or a hotfix branch we branched from master. Nothing gets to master unless all tests pass on development, and our staging server always has the current state of the development environment. The second something gets on master, it gets pushed to production.

It works fine for us, and branching off release branches would add a lot of complexity for literally zero benefit.

enki42 fucked around with this message at 13:17 on Mar 8, 2012

ufarn
May 30, 2009
What does GitHub do when you do a merge pull request with conflicts? Does it help you solve them interactively, solve them by itself or stop you with an error message?

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

ufarn posted:

What does GitHub do when you do a merge pull request with conflicts? Does it help you solve them interactively, solve them by itself or stop you with an error message?

It will tell you if the merge can happen without conflicts, and if it can't, it'll show you the commands to resolve the conflict on your local machine.

Dromio
Oct 16, 2002
Sleeper

Mithaldu posted:

Well, first off, step by step, what did happen here:

Whew... wasn't looking for all this. I know our process could use a bit of improvement, and that's not exactly what I was hoping to fix today. But since you asked, here goes:

Basic Development/Deployment Process

Our process is pretty simple. We have one "Production" branch which should ALWAYS be deployable. Developers create new branches from there to do their work. When the work is done they mark it "ready for QA" in our ticketing system.

Our product manager comes to me and says "I'm thinking about rolling out tickets 1,2, and 3". I create a new branch off Production. I merge in the branches created by developers for tickets 1, 2, and 3. I push this as a "QA" branch back to origin. Unit tests are run. The build is deployed to a QA server where we look over things and make sure they look right.

When we feel everything is good, I merge the QA branch back into Production. I run unit tests again. I deploy the result to our production server. I push Production back to origin so everyone who creates new branches will do so from the latest code base.

We do not automate deployment to production because I haven't been able to find a way to copy files from our CI system (in the office) directly to the production system (at our hosting service) without human interaction (entering a password). I'm still working on that part, but for now I simply enter a single command on my machine and it builds, runs tests, prompts me for the password, then copies and deploys. I know it's not ideal and I promise I'll try to find a better way.

Where *I* Went Wrong
This release took more time. When I made sure my local copy of Production was up to date, some files had been changed since QA was built. This isn't too unusual-- our designer will often update some minor UI assets without going through QA. But this wasn't one of those times. Instead, it was code changes from another developer. I absolutely SHOULD have examined these changes before rolling out. I failed. I updated my local copy of Production, then merged in QA. I ran the automated tests (which passed), then deployed.

What the Developer Did
The developer doesn't/can't use CLI git for various reasons. He's finally settled on SmartGit. Apparently he set up a tracking branch in SmartGit wrong when creating a new branch to do some work. SmartGit was pushing his changes back to Production without his even knowing it. He was as surprised as I was when I told him he had put code directly into the Production branch.

AND, he wasn't ready for this code to be shared, so he'd commented out the unit tests around this particular code so he could experiment. I've discouraged this practice, but he did it anyway. So when I ran my tests, all was green.

So...
We both made mistakes. I know that. He knows that. He doesn't WANT to be able to commit directly production, and has no real reason to. Which is why I asked about it. And hopefully Golbez's answer will do the trick.

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

What do teams do to solve the problem of "Does Bill have changes he needs to check in?"

We have people that aren't in this office (or just not in every day), and it'd be nice to be able to go to a website and see that Bill has 2 files he needs to check in and Tom has 3. I guess it'd depend on some sort of client-side program that checks for modified code on a users machine and reports back.

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

Bob Morales posted:

What do teams do to solve the problem of "Does Bill have changes he needs to check in?"

We have people that aren't in this office (or just not in every day), and it'd be nice to be able to go to a website and see that Bill has 2 files he needs to check in and Tom has 3. I guess it'd depend on some sort of client-side program that checks for modified code on a users machine and reports back.

This is not a problem that needs to be solved with software. Or even solved at all. How do you know what branch they have checked out/cloned, where it is checked out or any of that information? Just tell your developers to commit their poo poo.

baby puzzle
Jun 3, 2011

I'll Sequence your Storm.
Maybe they are non-mergeable files? Whatever version control you are using might have features to indicate that these files are checked out by somebody, but we don't know what you are using.

wwb
Aug 17, 2004

How I solve that problem is to set things up so any sort of deployment and such happens out of source control. If it aint checked in it don't exist.

Personally I would also slap the piss out of Bill too.

ufarn
May 30, 2009
Okay, I have merged my branch with master and resolved all conflicts in my local repo, but can it really be true that I am 40+ commits ahead of origin, just because my other branch was that many commits ahead of my master branch?

Final question before I press the `git push` trigger. :ohdear:

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug
Run this (assuming that 'master' is the right branch name):
code:
gitk origin/master..master
This is equivalent to gitk ^origin/master master, and shows you everything that's in your master branch minus everything in origin/master. These are the commits that you're about to push.

Lysidas fucked around with this message at 15:43 on Mar 16, 2012

enki42
Jun 11, 2001
#ATMLIVESMATTER

Put this Nazi-lover on ignore immediately!
Also, this doesn't exactly answer your question, ufarn, but one thing that we use to ensure that we aren't pushing unwanted changes to master, and just as a good way to review your code, is require that all changes to master are sent up as a pull request to GitHub. If you guys are using that, the diff view on a pull request really is excellent, and it lets you interactively add comments on certain line numbers and other nice things like that.

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Bob Morales posted:

What do teams do to solve the problem of "Does Bill have changes he needs to check in?"

We have people that aren't in this office (or just not in every day), and it'd be nice to be able to go to a website and see that Bill has 2 files he needs to check in and Tom has 3. I guess it'd depend on some sort of client-side program that checks for modified code on a users machine and reports back.

we use jabber

lol if you
Jun 29, 2004

I am going to remove your penis, in thin slices, like salami, just for starters.

Bob Morales posted:

What do teams do to solve the problem of "Does Bill have changes he needs to check in?"

We have people that aren't in this office (or just not in every day), and it'd be nice to be able to go to a website and see that Bill has 2 files he needs to check in and Tom has 3. I guess it'd depend on some sort of client-side program that checks for modified code on a users machine and reports back.


Perforce (or I suppose another well functioning, centralized SCM) handles all that by default. You can see at a glance if someone other than you has checked the file out, figure out who it is by clicking another tab, and even map out files (explicitly or by pattern match) to say "these files multiple people can check out and edit because their changes can be resolved, however these other files are first-come-first-served only because there's no meaningful way to merge conflicts in an excel spreadsheet so go find who has exclusive checkout on it and kick their rear end."

I've got something like 400'ish devs crawling all over a mountain of spaghetti platform code plus an undefined number of contractors allowed to touch the encryption widgets or the video storefront legal boilerplate etc etc etc and it works okay (In as much as they get any training letting them know what it means that someone submitted a change before their change.)

I'm also kicking around a concept to bundle up a developer workspace at the end of each cycle and "p4 shelve" to stash it on the server in a non-committed state. That way they can go home, hit the VPN, and grab the changes to keep working. Or just refresh their workspace back to point-in-time 5:30pm yesterday. Or get checked into rehab overnight and need someone else to take their code over first thing tomorrow morning.

Sonic H
Dec 8, 2004

Me love you long time
I have a question on VisualSVN.

I use non-default repo structures, but I'm wanting to take advantage of using tags. As far as I can tell, without setting up with tags/trunks/branches, the ability of SVN/Tortoise to recognise a given folder as a "tags" folder, then the ability is lost.

What I'm wondering is: Is it possible to tell SVN that a given folder is a "tags" folder (i.e. it's a folder not called "tags" but is recognised as a tags folder as far as SVN is concerned)?

Branching and Tagging does work, but it's possible to change things (not that I do) in the Release folder, which is obviously not desirable. Can I tell SVN that my folder called "Release" is actually a "tags" type folder?

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
SVN does not have any concept of a tag; it's purely convention. Even with the standard setup, you can freely commit to existing things in the tags directory.

wwb
Aug 17, 2004

^^^this. We had some idiot contractor who did a whole 6 month dev cycle in a tagged folder.

Sonic H
Dec 8, 2004

Me love you long time

Plorkyeran posted:

SVN does not have any concept of a tag; it's purely convention. Even with the standard setup, you can freely commit to existing things in the tags directory.

Ah, it must be a Tortoise thing then. Setting up a folder in the Tags folder popped up with a message warning that the current path is in the tags (it isn't).

I'll carry on as normal then, cheers :)

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
For a personal repository here, I suddenly got myself a steaming pile of broken links. I can't find the targets of the links anywhere. Since this is just for me, I don't have another developer against which to compare. My backups don't seem to have them either. Is there anything else I can do to at least make git happy again? It looks like I've lost some of my history. :(

Mithaldu
Sep 25, 2007

Let's cuddle. :3:

Rocko Bonaparte posted:

For a personal repository here, I suddenly got myself a steaming pile of broken links. I can't find the targets of the links anywhere. Since this is just for me, I don't have another developer against which to compare. My backups don't seem to have them either. Is there anything else I can do to at least make git happy again? It looks like I've lost some of my history. :(

This such an incredibly vague description that i can't even begin to guess what you mean.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Mithaldu posted:

This such an incredibly vague description that i can't even begin to guess what you mean.

Git won't let me do my normal operations against the repository right now due to various errors and error messages. When I run git fsck I get a pile of broken links. Say, tree abc's link to tree xyz is broken. I can do an ls-tree for abc but I can't ever do one for xyz. I have some backups and nothing has xyz. I have a few cases of that. I'm about to do some crazy code changes so I wanted source control available for reversion, but I'm at a good spot now. Since this is a personal repository, I'm tempted to init myself a fresh repository and just add the latest version of the current files. I am not sure I could do a push because of the broken links.

Update: I ended up having to start over. I got a little help over at #git. Specifically, that I was pretty well screwed. This is kind of annoying so I'll share.

I had a broken tree links where the source existed but the destination, as it was hashed, didn't exist in the database. With file objects I can rehash them and shut this up. The directories did still exist but had different hashes. One cannot use the object hashing command on directory trees. I tried to do mk-tree and got a different hash. From there, I couldn't figure out how to mend all links to that new hash. From what I could see given the circumstances, that didn't really matter.

I'm now looking into more rigorous backup strategies. I have some online web storage that takes SSH, but they won't add git. Regardless, is there a way to use scp to at least mirror stuff?

Rocko Bonaparte fucked around with this message at 14:21 on Apr 2, 2012

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug
BitBucket if you want private repositories or Github if you want to be public (or pay to be private). You can probably run your own Git server if you want but that's beyond my knowledge.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Rocko Bonaparte posted:

I'm now looking into more rigorous backup strategies. I have some online web storage that takes SSH, but they won't add git. Regardless, is there a way to use scp to at least mirror stuff?

If you can SSH into a machine, you can install Git yourself. If you don't have root access, you can still install it into your home directory:

code:
tar -xf git-1.7.9.5.tar.gz
cd git-1.7.9.5
make configure
./configure --prefix="$HOME"
make
make install
Ensure that ~/bin is in your PATH by setting this in .bashrc (I believe that this is one of the times when the difference between .bashrc and .bash_profile matters), and then you can store bare repositories on this machine and use them as remotes in your local repositories.

I strongly recommend that you just use Bitbucket or GitHub though.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Lysidas posted:

If you can SSH into a machine, you can install Git yourself. If you don't have root access, you can still install it into your home directory:

...

I strongly recommend that you just use Bitbucket or GitHub though.
I'm thinking about the public systems like Bitbucket. I can't install my own binaries with the kind of web account I have, so that takes care of that.

ToxicFrog
Apr 26, 2008


Rocko Bonaparte posted:

I'm now looking into more rigorous backup strategies. I have some online web storage that takes SSH, but they won't add git. Regardless, is there a way to use scp to at least mirror stuff?

Github is pretty excellent. Furthermore, if you have ssh access to something, you can stick a repository on it even without the ability to install git on it - just mount it using sshfs and create a "local" repository on the remote drive.

Failing that - since it's really a backup you're after, not a mirror - any dumb storage will do; just copy or archive your .git directory.

nexus6
Sep 2, 2011

If only you could see what I've seen with your eyes
We use git, nobody has been trained to use it.

Due to the rear end-backwards way we work, we treat it like SVN. There is a main repository I have to pull changes from to keep my code up to date, then I push my changes back up when they are done.

However, in order to have to code work on my machine I have to have unique configuration files which I must not commit or push back up. I have been keeping these file uncommitted.

Whenever I have to update, I git stash my config files, git pull to get the latest updates then git stash apply to reset my config files.

I have a problem now that whenever I run git stash apply I get

quote:

Auto-merging s/main.css
CONFLICT (content): Merge conflict in s/main.css
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 15887 and retry the command.

I have fixed the conflicts in the file, run git add s/main.css and even committed it but every time I run git stash apply I still get the exact same conflict error over and over and the rest of the stash is never applied.

I can't find anything in the git book, stackoverflow or Google about what I need to do.

Deus Rex
Mar 5, 2005

nexus6 posted:

We use git, nobody has been trained to use it.

Due to the rear end-backwards way we work, we treat it like SVN. There is a main repository I have to pull changes from to keep my code up to date, then I push my changes back up when they are done.

However, in order to have to code work on my machine I have to have unique configuration files which I must not commit or push back up. I have been keeping these file uncommitted.

Whenever I have to update, I git stash my config files, git pull to get the latest updates then git stash apply to reset my config files.

I have a problem now that whenever I run git stash apply I get


I have fixed the conflicts in the file, run git add s/main.css and even committed it but every time I run git stash apply I still get the exact same conflict error over and over and the rest of the stash is never applied.

I can't find anything in the git book, stackoverflow or Google about what I need to do.

is there any reason you're not putting those config files in .gitignore, or the repo exclude? it seems that would streamline your workflow quite a bit

wwb
Aug 17, 2004

Or better yet fixing the app so it can choose the right environment so you don't have to fight this particular boogeyman.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

nexus6 posted:

We use git, nobody has been trained to use it.

Due to the rear end-backwards way we work, we treat it like SVN. There is a main repository I have to pull changes from to keep my code up to date, then I push my changes back up when they are done.

This has me thinking now. We've just started adopting git on some of our two-man projects (moving from CVS on Sourceforge :gonk: ), and we pretty much do the same thing. Each of us clones the repo, does some work, pushes changes back, pulls the other guys'... and it just feels wrong. We've run into some merging issues here and there but we weren't sure how much of that was our fault for not having the best workflow.

We primarily develop in Eclipse so we're using Egit -- not sure how much that's adding to our problems.

Can anyone recommend a good resource that just lays it out in simple terms, "here's the best way to set up your workflow for a small number of users working concurrently"? I don't need any of that dictator-model stuff -- both of us know what we're doing on the project and don't need to complicate things by adding access tiers.

I've got the Pro Git book, but I'm looking for something that dumbs it down even more than that.

wwb
Aug 17, 2004

I'm pretty partial to this model: http://nvie.com/posts/a-successful-git-branching-model/

Works good for teams of one or more.

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

Flobbster posted:

Can anyone recommend a good resource that just lays it out in simple terms, "here's the best way to set up your workflow for a small number of users working concurrently"? I don't need any of that dictator-model stuff -- both of us know what we're doing on the project and don't need to complicate things by adding access tiers.

I've got the Pro Git book, but I'm looking for something that dumbs it down even more than that.

I use Github for everything and it works very well. We have an organization set up and that has our canonical repository. It only has one remote branch, master, and everything is built and deployed from it. No one ever pushes anything other than master to the canonical repository. I have a Github Post-Receive HTTP hook set up to hit our build server every time something is committed to the canonical master. If the build is good, it's deployed with capistrano. Makes for very efficient releases.

Next, each of us have personal Github accounts and we fork the canonical repo to our personal accounts. This is where I'll push remote branches and don't have to be worried about messing things up.

On my clone, I set up two remotes, one to the canonical repo and one to my fork.

I can branch, do all of my work, push to my fork. I use capistrano for everything, so I need to stage my branch? Make sure it's pushed and do:

code:
DEV=my-github-username BRANCH=branch-name cap staging deploy
Bam, easily deploy my feature branch to staging. Then when I'm ready to release, pull in master, merge, push to canonical, and our build process handles it from there.

This works pretty well for a small team of 3, 4, 5 people. Team of 50? You'd have to have a lot of disciplined developers.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

ToxicFrog posted:

Github is pretty excellent. Furthermore, if you have ssh access to something, you can stick a repository on it even without the ability to install git on it - just mount it using sshfs and create a "local" repository on the remote drive.

Failing that - since it's really a backup you're after, not a mirror - any dumb storage will do; just copy or archive your .git directory.

I had actually tried this so maybe I have something else to ask about here. I'm working on Windows here, using Git Extensions. The closest I found to being able to mount sshfs is DokanSSHFS. For simple copy kind of operations it was working fine. However, I couldn't even init a repository with it. Something in the Git Bash with Git Extensions was also getting in the way; it was flipping around path separators and then not finding the path. I have no idea what the deal was there. I imagine you were thinking about mounting sshfs on Linux, but I'm wondering instead if there's a well-vetted method for doing the same on windows.

uXs
May 3, 2005

Mark it zero!

Flobbster posted:

This has me thinking now. We've just started adopting git on some of our two-man projects (moving from CVS on Sourceforge :gonk: ), and we pretty much do the same thing. Each of us clones the repo, does some work, pushes changes back, pulls the other guys'... and it just feels wrong. We've run into some merging issues here and there but we weren't sure how much of that was our fault for not having the best workflow.

Seems ok to me. Pull. Do work, commit. Repeat that step until you feel like pushing. Then pull & merge anything that changed while you were working, and push.

Of cource, if you're one of those weirdos that insists on a linear history, then never mind.

Adbot
ADBOT LOVES YOU

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


A :spergin:-ful git branching model.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply