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
Mr Shiny Pants
Nov 12, 2012

necrotic posted:

Gitea is way better than gitolite and lightweight as hell.

This look cool, I'll give it a try. Thanks.

Adbot
ADBOT LOVES YOU

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

Murrah posted:

Sooooo talking about switches... my small company is about to make the switch from.... Subversion to Git! Talk about time for modernizing.

I've helped transition two huge teams to this over the course of my career so far. Make sure everyone understands the differences and be prepared to help some of the weaker git members get up to speed. Git is great, but does take a little bit of learning to really get going. Don't be afraid to use a GUI tool instead of forcing everyone on CLI.

Mrenda
Mar 14, 2012
Probation
Can't post for 5 hours!
I'm making something that involves a secret key to pull data from an API, but I obviously don't want that on Github. What do I do about pushing the file but hiding the secret key? I've seen mention of config files but I'm not sure how they work with python/windows.

hirvox
Sep 8, 2009

Mrenda posted:

I'm making something that involves a secret key to pull data from an API, but I obviously don't want that on Github. What do I do about pushing the file but hiding the secret key? I've seen mention of config files but I'm not sure how they work with python/windows.

I don't know python, but the Windows INI file format seems simple enough that it could be used with layered config files. You put everything you don't mind disclosing into the main configuration file and use placeholder values for anything sensitive like API keys. You read that with ConfigParser.read as usual. Then you use the same instance of ConfigParser to .read a second configuration file, which will only contain those sensitive configuration values. The values in the sensitive configuration file will override the placeholders in the main configuration file. You commit the main configuration file as usual, and put the sensitive configuration file's name into a .gitignore file in the root folder of the repository. Afterwards, git will ignore that sensitive configuration file and keep it out of source control even if it changes.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Mrenda posted:

I'm making something that involves a secret key to pull data from an API, but I obviously don't want that on Github. What do I do about pushing the file but hiding the secret key? I've seen mention of config files but I'm not sure how they work with python/windows.

The most popular way of handling this is reading the secret key from an environment variable and never having it in your code base anywhere.

edit: of course, I just assumed this was a web server because surely everyone is writing the same sort of code as me...right?

Murrah
Mar 22, 2015

Update: my small companies migration from subversion to Git is going smooth.

The only hangup was that it turned out there were some overlapping case sensitive files i.e E.png and e.png that were in version control on subversion. Because we handled these files on linux remotes there was no issue.

It took making changes to the files and then completely blasting/ re cloning the git repo on my mac and on a coworkers windows computer that were set to case insensitive to get going

huhu
Feb 24, 2006
For some of my projects, from the start I put a create a config.py.template file, put config.py in my .gitignore, then copy the template file to config.py and put my keys in there.

necrotic
Aug 2, 2005
I owe my brother big time for this!

huhu posted:

For some of my projects, from the start I put a create a config.py.template file, put config.py in my .gitignore, then copy the template file to config.py and put my keys in there.


Use something like foreman run or dotenv to easily inject environment variables, then have the config.py use those variables.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I'm wondering if there's a way in git to specifically check for lines that were changed in branch A versus branch B. You might think that git diff is what I'm talking about, but I don't care as much about lines that branch B changed versus branch A. I'm trying to do a final sanity check that I have merged fixes from a release branch back into master. Master has a few more changes in it that I don't want to pollute the output.

My idea is that I might just find one or two lines that I can determine where additions on master to changes that may have come in from the release branch already, and be able to tell that I have covered everything.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop
I've used git for years, and suddenly on a single project I'm having the most bizarre behavior: commits are just vanishing.

Nothing in the log, no revert, not a merge. Like the commit was just skipped over at some point and the tree rebuilt without it.

I thought it was some bizarre merge artifact, but after the 4th time I've made the same fix I started searching, and once again it's only present in the tip of the tree.

I feel like I'm going insane.

I checked unreachable, and lost+found, and reflog. I'm beyond confused.

Now the repo has a ****** WHY THE gently caress DOES THIS FIX KEEP VANISHING ***** with 10 lines of asterisks, because if that's gone I just don't know.

E: this is on my local machine, not the shared repo - nobody else has access for wacky hijinks. I've had entire feature sets working and tested - and other people tested the local server as well, that just went away without a single trace.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I had something happen before but it was long enough ago that I can't tell if it was more that I wasn't capable of understanding the problem or if there really was something screwy happening. I ended up cloning again and it just went away like that.

I think even if you are having disk problems that generally git will notice that something is screwy.

It shouldn't work this way at all because your commit wedged in the middle of the history should change the checksums of the commits that follow it. I can only think that git mended around it and you did an aggressive GC that wiped the orphan.

comedyblissoption
Mar 15, 2006

I would check your GC settings and make sure it's not super-aggressive somehow. Maybe you're doing a rebase or something and some part of your tooling is accidentally destroying commits combined with an aggressive GC?

You could also try pushing your work to a repo regularly in a feature branch and see if it ever differs from your local branch. That remote repo can even be on the same local disk as your working local repo.

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

Rocko Bonaparte posted:

I had something happen before but it was long enough ago that I can't tell if it was more that I wasn't capable of understanding the problem or if there really was something screwy happening. I ended up cloning again and it just went away like that.

I think even if you are having disk problems that generally git will notice that something is screwy.

It shouldn't work this way at all because your commit wedged in the middle of the history should change the checksums of the commits that follow it. I can only think that git mended around it and you did an aggressive GC that wiped the orphan.

Unless my PC is magically capable of pre-image attacks against SHA2, I'm going with the tooling reflowing the commits around it.

comedyblissoption posted:

I would check your GC settings and make sure it's not super-aggressive somehow. Maybe you're doing a rebase or something and some part of your tooling is accidentally destroying commits combined with an aggressive GC?

You could also try pushing your work to a repo regularly in a feature branch and see if it ever differs from your local branch. That remote repo can even be on the same local disk as your working local repo.

GC settings are stock AFICT

pre:
$ git config -l
color.ui=true
push.default=simple
push.followtags=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
branch.master.remote=origin
branch.master.merge=refs/heads/master

$ git config -l --global
color.ui=true
push.default=simple
push.followtags=true
GC settings are default, and I've got orphaned tips from rebasing a week old.

It must be lack of sleep, I'm integrating code from around the world right now which means basically being awake every timezone for a few days. If it wasn't for other people asking where features went I would have thought I was hallucinating doing the work.

I must be doing work and hallucinating the commits, then merging code that blows away my uncommitted changes. I should script a force-stash for dirty directories, at least that way they'll exists in .git/objects. Doesn't help that I'm doing it from two separate computers for logistical reasons.

ChickenWing
Jul 22, 2010

:v:

Sounds to me like someone is doing sneaky rebases

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Well in that case, there might be some elf magic in your IDE that can help. PyCharm keeps a history of file changes that I have used before to pluck stuff that I otherwise just could not find anywhere. I don't know all the rules that trigger it other than when saving a file, so such things still won't help if the changes are all offline git commands.

I have suffered similar problems before when integrating code and have resorted to cherry picking more than rebasing. Something in my little brain is better about that command even if a rebase is basically cherry picking over and over.

22 Eargesplitten
Oct 10, 2010



Is there a site that provides free private repositories for git? I want to keep some stuff private but don’t want to use a local repo in case my hard drive kicks the bucket. The only other thing I can think of is set up a repo on Google Drive, but I’m not sure how well that works.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do
I use BitBucket for that. I think GitLab also does it now, if you don't like Atlassian.

The Fool
Oct 16, 2003


VSTS also provides free private repos.

Vanadium
Jan 8, 2005

keybase also has a private git repo feature, probably so people stop putting git repos directly on their encrypted distributed file system. I'm not sure how awkward it gets if you want to share the repo with someone eventually, but at least it's gonna be hella encrypted.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Does anyone know if it's possible to configure github to do a daily digest of notifications instead of sending an email for each notification?

I haven't found it, and I suspect that they don't, since it would probably interfere with the associated workflows of being able to reply to notifications, etc.

Happiness Commando
Feb 1, 2002
$$ joy at gunpoint $$

Please help with babby's first version control system. I am trying to get an on-prem hosted git repo working for our powershell scripts. I need the repo to live on some arbitrary file share, and the goal is to get random workstations and servers to use VSCode to natively work with the remote repo.

I can make a remote repo and clone it locally. When I sync in VSCode, which does a pull and then a push, I get the following error:
code:
Git push origin master
Remote:error:refusing to update checked out branch: refs/head/master
By default, bla bla non bare repository will make the index and work tree inconsistent 
[remote rejected] master - >master (branch is currently checked out)
OK, well, if I make the repo bare, then I can't get the files stored on the share. They apparently live locally, and the the bare repo is just for version control. So then I tried cloning the bare repo to a different folder on the same server - so that the files could be saved on the share - which worked fine enough. But when I cloned the clone locally, so that I could edit the files and then pushed them back to the remote, I get the same error.

I tested using VSTS, like a month ago and managed to get it working. But for production we need to host it ourselves, and I can't figure out what the hell I'm missing.

Edit: To be clear, the goal is for this to be as braindead simple as possible, affecting our workflows as minimally as possible. Right now each person stores their scripts in a different share. They are run from a variety of servers using the Powershell ISE and edited from a similar variety of servers. The plan is to have one share with all scripts, version controlled so that we dont lose changes from being saved in the wrong place or from the wrong machine or whatever. And using VSCode because it's free, it can be pushed to all servers instead of the ISE, and it natively deals with git - having to type a bunch of commands at the shell with every change we make isn't going to work.

Edit2: Why the hell did I clone the clone?

Happiness Commando fucked around with this message at 02:35 on Oct 2, 2018

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The portion of the error message you snipped out tells you exactly what setting you have to change on the server to let you push to the checked-out branch.

Happiness Commando
Feb 1, 2002
$$ joy at gunpoint $$

The way I'm parsing this it presents two options
1) you can set this to ignore or warn, but you should update the work tree some other way

2) you can turn off this error message and retain this error behavior.

I don't know how to update the work tree some other way, and again, the point is to use whatever VS Code does natively so that we don't have to engage with the command line.

code:

> git pull --tags origin master
From \\dc04\it\script-files\scripts
* branch            master     -> FETCH_HEAD
> git push origin master:master
remote: error: refusing to update checked out branch: refs/heads/master       
remote: error: By default, updating the current branch in a non-bare repository       
remote: is denied, because it will make the index and work tree inconsistent       
remote: with what you pushed, and will require 'git reset --hard' to match       
remote: the work tree to HEAD.       
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable       
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into       
remote: its current branch; however, this is not recommended unless you       
remote: arranged to update its work tree to match what you pushed in some       
remote: other way.       
remote:
remote: To squelch this message and still keep the default behaviour, set       
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.       
To \\dc04\it\script-files\scripts
! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to '\\dc04\it\script-files\scripts'
> git show :scripts/WebServerAdditions.ps1

Apologies for the phone formatting

22 Eargesplitten
Oct 10, 2010



Are there any good GUI-based programs to work with Git on Windows? I want to set up a repo on my Pi, but my wife wouldn’t want to learn how to work everything through the command line.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

22 Eargesplitten posted:

Are there any good GUI-based programs to work with Git on Windows? I want to set up a repo on my Pi, but my wife wouldn’t want to learn how to work everything through the command line.

Sourcetree is decent. But why not use one of the multitude of free repo hosting services instead of using a raspberry pi?

Mega Comrade
Apr 22, 2004

Listen buddy, we all got problems!
SourceTree or gitKraken

The Fool
Oct 16, 2003


I find vs code's git integration to be perfectly useable.

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!

Any thoughts on tuning the self hosted free version of gitlab vs just plain old git on a server for a team of 5 using about 10 different web projects?

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
Is there a way to define a set of users that can run git push for a particular branch? I'd be cool for revoking everyone's push access to a branch as well.

Using the git cli tool only unfortunately.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

elite_garbage_man posted:

Is there a way to define a set of users that can run git push for a particular branch? I'd be cool for revoking everyone's push access to a branch as well.

Using the git cli tool only unfortunately.

In vanilla Git? No. Are you using a service that hosts repos? If not, start, they all allow that.

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
Well that sucks. Is there a stand alone solution? Unfortunately we can't use external project hosting, or even software that requires and internet connection for licensing.

The Fool
Oct 16, 2003


Bob Morales posted:

Any thoughts on tuning the self hosted free version of gitlab vs just plain old git on a server for a team of 5 using about 10 different web projects?

I might be shilling a bit, but consider VSTS Azure DevOps if cloud hosted is an option. It is free for 5 users.

Dylan16807
May 12, 2010

New Yorp New Yorp posted:

In vanilla Git? No. Are you using a service that hosts repos? If not, start, they all allow that.
Isn't the vanilla git answer putting some code in .git/hooks/update?

Hughlander
May 11, 2005

elite_garbage_man posted:

Is there a way to define a set of users that can run git push for a particular branch? I'd be cool for revoking everyone's push access to a branch as well.

Using the git cli tool only unfortunately.

You can add something to a pre-receive-hook to do that.

elite_garbage_man
Apr 3, 2010
I THINK THAT "PRIMA DONNA" IS "PRE-MADONNA". I MAY BE ILLITERATE.
Thanks for pointing me in the right direction.

Sakco
Jun 6, 2009
Check if https://github.com/sitaramc/gitolite fulfils your needs.

poemdexter
Feb 18, 2005

Hooray Indie Games!

College Slice

Small consultant shop I worked at for a couple years had this on a mac mini for internal projects and it was simple to maintain. I definitely recommend it.

22 Eargesplitten
Oct 10, 2010



Is it possible to make a single file public in a bitbucket repo? I want to be able to send codepens with the images from bitbucket, but I want the rest of it to be private.

necrotic
Aug 2, 2005
I owe my brother big time for this!
No, it's a repo level permission only. I don't know of any SCM host that let's you do permissions at the file level. Branch seems more likely, I know some of the servers support branch level permissions but not hosted one's like BitBucket

Adbot
ADBOT LOVES YOU

raminasi
Jan 25, 2005

a last drink with no ice

22 Eargesplitten posted:

Are there any good GUI-based programs to work with Git on Windows? I want to set up a repo on my Pi, but my wife wouldn’t want to learn how to work everything through the command line.

https://github.com/gitextensions/gitextensions

It's extremely good about being a GUI for Git, rather than a GUI that uses Git under the hood. It's not the prettiest but it's great to use.

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