You are not logged in.

#1 2017-04-29 13:08:54

leggettc13
Member
Registered: 2017-04-25
Posts: 16

[SOLVED]Git commands are requiring sudo every single time.

I have a LAMP stack set up on my Arch Linux distribution and wanted to initialize a git repository in a directory in the srv/http/ directory that contains files for a PHP tutorial that I am following, so that if I want/need to I can sync the project between machines via GitHub later. However running the git commands requires sudoing for every single command, and I don't think it is supposed to. I had set up a similar situation on a different installation of Arch Linux before I reinstalled to Dual Boot with Windows 10, so unless I'm misremembering I know this is doable. The only difference I know of between those installations was that I set up a separate root and home partition on this one which I did not do previously. How can I fix this/make it easier. I'm not sure what files / outputs would be useful to show here so if you need more information just ask.

Last edited by leggettc13 (2017-04-29 14:20:00)

Offline

#2 2017-04-29 13:48:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED]Git commands are requiring sudo every single time.

What are the permissions on/under /srv/http?  If you user doesn't have write access, then what you describe is normal.

Also note git != github.  You can sync directly between computers with git - that's the point.  Github is if you want to host a copy on someone else's computer with a fancy web UI.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-04-29 13:57:58

leggettc13
Member
Registered: 2017-04-25
Posts: 16

Re: [SOLVED]Git commands are requiring sudo every single time.

It appears the /srv/http directory is owned by the root user and root group. Strange then, that this is considered normal when it was working differently the first time I installed Arch Linux. And there were certain commands then too that had to be sudoed but if I remember correctly git commands didn't. I still have that installation on a hard drive, let me swap out my disc reader and swap that drive in and double check that real quick.

EDIT: Just double checked, the owner and group of the directory are different on my previous install, they belong to my user instead of root. How odd, I don't remember explicitly changing them.

EDIT2: Found out how to use the Apache user directories, this serves well enough for learning purposes so I'll consider this problem solved.

Last edited by leggettc13 (2017-04-29 14:19:00)

Offline

#4 2017-04-29 16:54:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED]Git commands are requiring sudo every single time.

user directories are fine, but completely unneeed.  Just chown the relevant files/directories.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB