Conditionally setting your gitconfig
utf9k.net
utf9k.net
Obviously check your contract, and IANAL but people should be cognizant of the fact that your employer _may_ be able to retain copyright on personal projects if you use a work device (then again some contracts may even try to claim that they retain copyright for work done in personal time on personal devices)
I've even had people build their own PCs when starting at startups because they wanted specific specs.
As an added bonus, it gives you one more place to run bloated^Wmandatory Electron apps.
I'd rather keep my .gitconfig hacks and a single machine.
Depends on the job. Work machines are often unusable because of measures mandated by employers to protect IP. Especially with big employers, you can't just get a random physical or virtual machine and do work-related things on it, not without angering the IT or cybersecurity department.
Not everyone has the same "dirt cheap" requirements for hardware for work; I work in games where a medium-range GPU is a requirement, and compiling large projects requires a much higer spec CPU (e.g. everyone on our team has at least a 3970x, which is ~$2000, and comes with a motherboard of $800). There's also space considerations - having two desktop machines works if you live in the US where houses are enormous; meanwhile I live in a 500sqft apartment with a 55 inch wide desk in my second bedroom - putting a second tower, plus extra power plus a KVM plus extra networking is a no-go.
I used my own machine while the work-provided laptop sat next to me the whole time until I was forced to use the provided laptop. On one hand, my life-work balance improved, on the other hand I loath the stupidly slow machine that seems limited in every aspect compared to my own.
From experience, I totally understand your frustration - and to anyone in this situation, I would suggest leaving to a company that provides modern hardware. That being said, I humbly ask that you try to put yourself in the shoes of those who are charged with ensuring these machines remain complaint (contractual obligations that must be met). Meeting these compliance obligations means continued, uninterrupted business, and that business pays our salary.
From a security/compliance perspective, I don't think it's unreasonable to do your work on a locked down machine if you are able to do your job, assuming that you have a modern machine that will plow through the overhead effortlessly. If you weren't provided with a modern machine though that can do this - get out of there as fast as you can.
Not at all. But from a security perspective I think it's also not unreasonable to request that my data isn't exfiltrated to some shady anti-virus company and my personal details aren't stored in a rancid (active) directory service.
And I just... don't care anymore. I know it's not y'all's fault. It's the fault of the biz world which refuses to cater to any but the lowest common denominator. They could go for a solution that works with minimalist Linux systems so their sec suite doesn't conflict with my desired userland, like say a kernel extension interfacing with a daemon that just does the basics. Offer instructions and say you're on your own if you wanna go this route. Instead I get Carbon Black rammed down my throat. Which is better than McAfee but still. And McAfee still won't uninstall cleanly, and guess whether I have root access.
The problem is these companies simply don't want to work with their most capable and talented engineers. And, well, I just don't care anymore. These companies can just bleed talent to the free software sector for the next decade or two.
It's been awesome. Everything set up exactly how I want it, with beautiful themes, colors and shortcuts.
Anyway, I could work with my old macbook, but it's giving the ghost, the screen is fooked and getting that fixed is too expensive.
I've been working on MacBooks for work for the better part of a decade, in large part to keep my work and personal machines separate, but I was much better off when I just did work on my personal Linux machine. I also didn't have to deal with switching monitor inputs and KVMs and the clutter of a laptop taking up precious desk space.
The kind of company you want to work for in that cases is one that just lets you buy whatever machine you want, with a budget that exceeds whatever you'd buy for your private one.
Personally, I do inquire about open source copyright clauses when applying for a job.
I don't do any development on my work laptop but I do push updates to my dotfiles and the notes section of my site from time to time which is mainly what I use it for.
As far as I understand, it is (was?) a big issue in California but I don't believe it was ever a thing here in New Zealand nor do I think it would hold up legally as I understand it.
As always, buyer beware of course
(There was a thread about this recently which I can't find)
This is important when you are a salaried employee.
BUT: There's often very good reasons to do paid work on your personal equipment. If you're a contractor, if you juggle contracts, if you're a founder or an early employee...
[user]
name = My Name
useConfigOnly = true
You get an "Author identity unknown" error when committing to a repo the first time and then you just run this once to set up that repo: git config --local user.email "me@email.net"- My office PC is much more powerful than my laptop and I don't need to deal with its maintenance
- I can switch between work and office with couple of clicks
- No chances of accidental overlap as I don't see one while using the other (I run full screen); provides mental separation too
- I don't need to put Windows on my personal machine (I run Linux)
- No work stuff getting into personal machine or vice versa so I don't need to do workarounds such as the .gitconfig setup mentioned in the article
The only problem I have observed is that Citrix on Linux seems to have issues exposing the external webcam as an available device when I join a meeting from within the Citrix session (for which we use Citrix (!) WebEx no less!). Cheese on Linux can handle the webcam perfectly fine. When I absolutely must enable Video, I just connect to the meeting directly from my laptop (which is a rare requirement in my case). But this problem could be a show-stopper for those who use video regularly and connect from Linux (my colleagues who use Windows say it works fine for them).
https://git-scm.com/docs/git-config#Documentation/git-config...
git config core.sshcommand "ssh -i /path/to/project/keyfile"You could also say 'why does global git config exist at all, you can always just use .git/config on a per-repo basis'.
But when I need to make a quick exception to this (private project on my work device or work project on my private device), I'm just using the `.git/config` of the repository. It's far easier and reliable.
Still, this is a neat thing too.
My source lives in a directory called ~/src, bunch of different repos. My work source repos live in ~/src/company so this way, I point the global git config there when in a repo under that directory.
I use direnv for this.
However, that is a personal choice, I understand :-)
A solution is to make a dummy repo in the repo where includeIf points to - but that is annoying a little, as sometimes it confuses IDEs or makes shell (ZSH + addons) slower - as it tries to seek for changes.
The best solution I've found is to unconditionally include an additional config in the main config. But the additional config is coming from a dynamic location that I mount in my shell when I work. Basically during the working hour I mount my entire partition which is encrypted under ~/work. And I have my config under ~/work/.gitconfig. I have also there my additional shell config - so during working hours I have everything set up. The cons is that I need to mount/unmount that partition every day.
https://hediet.github.io/git-line-endings/
A github action brute forces all combinations of line endings and tries out what happens on checkout etc.
It's like using AWS SSO and containers in Firefox, and standardized profile names in AWS config that allow multiple/cross account access.
It's just key=value. Whether value is a URL, a number, a shell command -- totally up for interpretation.
Sure, not having a schema has it's downsides but by god, I love git config.
Just give it a few years, and we'll have statements like "IncludeIfFileExistsAndSatfisfiesConditionXandY" and you'll be begging for a Turing complete language ;)
Also, what happens if your configuration file contains a typo, say "eemail" instead of "email"? My guess is that Git will simply ignore it, whereas in a programming language, you would call "set_email(...)" and you would get an error if the function didn't exist. Now that's what I call sanity.
Sort of - you will set the config option "eemail", but yes, of course anything looking for "email" configuration will ignore it.
I have a shell script I use to set my defaults for gitconfig on personal projects, and have my user level gitconfig set up for work, but this is so much cooler. I already keep my personal junk in ~/Projects/donatj so that makes this easy!
Well yeah, but not because of conditional config... I wonder what this person thinks the `--global` in `git config --global` means?
This is the last thing I need so that I can have one set of dot files for both personal and work machines without any horrible hacks.
For each repo you have config file in .git folder where you can simply add user section just like in global and it will override it.
I use that because I work for different customers and have emails for them.
I have `~/Code/<me>` for personal, and `~/Code/<company>` for work stuff, I can do this trick and all ~/Code/<company>` repos use my work identity whether I have 1 repo in it or 1000. (Currently have 23).
If you want to trigger some specific behavior per directory, have a look at `chpwd` for zsh, it's a function you can redefine that gets called every time you enter a new directory. You could for example have a chpwd function that checks if you're under ~/work, if there's a .git directory, and then adjust the remotes as you wish.
chpwd docs: https://zsh.sourceforge.io/Doc/Release/Functions.html#Hook-F...
This gist seems to describe a technique for achieving the same thing with bash (I haven't tried it): https://gist.github.com/laggardkernel/6cb4e1664574212b125fbf...