Using VS code to edit HA files - what user to use?

Hi, I want to use VSCode to edit my configuration files on home assistant. I have the entire set up done but stuck at a place where the user “pi” I use to connect to HA does not have permissions on the files to edit. I realized this and read up some articles on how to manage users on the pi and so created a separate user called “haedit” just for editing HA config files. I also included this user in the relevant groups.
Now the issue I am facing is that some files like .git and other hidden directories were created previously are all owned by root. I changed the owner to haedit but I am unable to change it for directories like .git. As a result I cant checkin any files via VScode. But then while doing all this, I think I am not taking the right path in defining the users for remote development via VScode.
Can somebody guide me on how should I be managing my users on the Pi for HA files specifically as I want the freedom to make changes to them from VSCode as well as File editor add on within HA. And of course I don’t want permissions for all files to be 777.

My setup: Raspberry Pi3B+ w/ Buster, I use Hassio , Docker.

I know there is a VS Code add on but as it does not support Arm yet, I cant use it on the Pi.

Can you not just edit the files via the SAMBA share addon?

Well, I like to use VScode as an editor. It also gives all git integration and a host of other addons which are useful.

So do I.

I browse to the /config SAMBA share and create a workspace there.

I agree with Tom and to be honest I’m not entirely sure what you mean by : -

The point must be too subtle as it’s lost on me.

Tom is suggesting that with samba access to your configuration folder, VSC can use that access to edit your files. What do you mean about ‘git integration’ ???

Oh I see what he was saying. Backup to github. I don’t use that so have no idea.

I do use other addons though (the home assistant helper, mdi icons, rainbow indent, rainbow brackets etc…).

1 Like

But why would samba prevent a github backup ?
Knowing @Burningstone, he probably backs up to google home, github, local NAS, USB drive, Local PC, the dark side of the moon and proxima centuri

:man_shrugging:

I think it is about editing via VS Codes SSH capabilities.
I use the pi user for that and use certificates. Disabled passwords on the pi for security reasons.

Just put the pi in a group that has Write access to the files

VSCode has a git “integration”, you can directly commit changes etc. to Github from VSCode.

But I still don’t get why OP doesn’t just follow @tom_l’s advide from the first reply. I also edit the files through SAMBA (I installed Samba directly on the host and not with the add-on, but that doesn’t matter) in VSCode and push changes to GitHub etc.

1 Like

I do my remote development via Remote SSH on VScode. I think what I hear is that you guys are suggesting to edit files via Samba share instead of Remote SSH (and continue editing from within VScode). I dont know how would that happen but will find that out.
But keeping that as the second option, I dont think Remote development via VScode is an alien thing, isnt it. There must be a proper way to do it after setting up users and permissions properly. I can certainly change all file permissions for haedit user and then not create files outside of VScode , if nothing works.