# Project file permissions and Git on Windows

**URL:** <https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 25, 2021, 8:23pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847 "2021-02-25T20:23:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [February 25, 2021, 8:23pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/1 "2021-02-25T20:23:20Z")

</div>

What’s everyone doing for file permissions when using Git to back up projects?

I’m trying to set this up in a way that makes sense which seems to be difficult for Windows.

All of the project files are in “Program Files” 🤦 which isn’t user writable so I’m thinking my options are run `git bash` as admin which is obviously not ideal (and there’s no `sudo` on Windows) or add u+w to the projects folder which of course fails partway through. Is this a sane approach? Do I need to stop the gateway service to update file permissions? Who is supposed to own these files and does it even matter?

In typical Windows fashion I get errors like "An error occurred while applying security information to: " and then a partial filename because the operating system is too stupid to understand that wrapping text is a thing and that filenames may exist that are “more than 20 characters and less than the NTFS character limit + 1” in length

What’s the PowerShell equivalent to `chown -R user ./projects; chmod -R u+w ./projects; sudo rm -rf /` cause that’s about where I’m at 😃

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [February 26, 2021, 4:43pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/2 "2021-02-26T16:43:20Z")

</div>

I’ll invoke Cunningham’s law - I’m pretty sure git only stores the executable permission, not anything more complex. You _can_ manually invoke an index update _just in git_, without actually modifying the files:  
[https://git-scm.com/docs/git-update-index#Documentation/git-update-index.txt---chmod-x;](https://git-scm.com/docs/git-update-index#Documentation/git-update-index.txt---chmod-x;) maybe that fits your needs? (which I’m not entirely clear on…)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 26, 2021, 5:24pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/3 "2021-02-26T17:24:18Z")

</div>

Running git on Windows with services makes my head hurt. Y’all are masochists.

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [February 26, 2021, 7:52pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/4 "2021-02-26T19:52:26Z")

</div>

@chasondeshotel I am about where you are. Git is miserable in Program Files in Windows. Only semi-stable thing I have going is I run all my git commands as an Admin user, but agree its not pleasant.

Right now, we have Git invoking through the Project Update script, but we are soon looking to change that approach to a Git repo per project and have a Perspective UI that triggers sendMessage commands to the GW to execute git commits for projects when developers want to commit their project.

---

<div class="post-metadata">

**Author:** ![calimero100582](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/calimero100582/32/18630_2.png) [@calimero100582](https://forum.inductiveautomation.com/u/calimero100582)\
**Post date:** [February 26, 2021, 10:37pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/5 "2021-02-26T22:37:26Z")

</div>

Why do you want to change Unix file rights in Windows? I would not mess with file access within bash in Windows, as those rights are mostly ignored by Windows anyway. run git command directly without going through bash

If git have issue, it’s probably with writing to .git folder, which you can give access from within Windows once, and it should not change back

If you can give more details, or a sample script I can check, but Windows files when created usually inherit it’s parent rights, so changing projects folder manually will fix the issue, and you will only have to do this again when you setup a new gateway

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [March 2, 2021, 3:13pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/6 "2021-03-02T15:13:03Z")

</div>

@paul-griffith I actually saw that, good to know but not quite the issue I'm having. It's not any permsisions errors between copies of the repo, it's just the repo is not writable by users (as it inherits permissions from 'Program Files') so I have to run git commands as administrator (bad practice) or change the projects to user writeable (which may require stopping the gateway or have unintended side effects). I guess my question is "how are other people dealing with this?" and "how have others incorporated git into their workflow?"

> Right now, we have Git invoking through the Project Update script, but we are soon looking to change that approach to a Git repo per project

That's an interesting approach. It seems like you'd lose a lot of the benefits of git... but that sounds super useful if you have developers you don't want to give ssh/rdp access to. I do repo per project; almost did git submodule but there's just too many ways someone could inadvertently overwrite your stuff

> UI that triggers sendMessage commands to the GW to execute git commits

All this to get around permissions or...?

> Why do you want to change Unix file rights in Windows?

I don't, I just want them to be user writable. Saying `u+w` was (poor given the context) shorthand

> If git have issue, it’s probably with writing to .git folder, which you can give access from within Windows once, and it should not change back

That would work as long as you were only making changes locally and not pulling changes from anywhere else. As soon as git tries to change a file it's going to croak

> Windows files when created usually inherit it’s parent rights, so changing projects folder manually will fix the issue

That was my first instinct but that update failed... presumably because Windows can't handle doing anything with open files 🤦. So I'm guessing I have to stop the gateway to update permissions and I figured I'd better ask around before taking the gateway down. And if I have to take the gateway down to update permissions every time I create a new project it sounds like running git as administrator is what I'll end up doing

> Running ~~git on~~ Windows ~~with services~~ makes my head hurt

Yes exactly

---

<div class="post-metadata">

**Author:** ![meredithj](https://avatars.discourse-cdn.com/v4/letter/m/cc9497/32.png) [@meredithj](https://forum.inductiveautomation.com/u/meredithj)\
**Post date:** [March 9, 2021, 8:02pm UTC](https://forum.inductiveautomation.com/t/project-file-permissions-and-git-on-windows/43847/7 "2021-03-09T20:02:38Z")

</div>

I know that I tried running all of the git commands from the gateway as os.system commands and they should have the right permissions (usually until someone tries to adjust something outside of ignition).

I do agree that Git on windows with ignition makes my head hurt quite a bit.
