Re: [git-users] error: could not lock config file .git/config: Permission denied

2018-12-03 Thread Konstantin Khomoutov
On Mon, Dec 03, 2018 at 07:45:06AM -0800, chiahunglin@gmail.com wrote:

[...]
> git remote set-url origin https://...
> 
> git complains `error: could not lock config file .git/config:
> Permission denied`. All solutions found online suggest changing with
> `chown`. But that's not the case because all dirs under the directory
> with user and group configured are with my account e.g. 
> 
> My account is , and group is . Source dir called
> my-project is stored under /path/to/parent-project.
> 
> `ls -alh` parent project dir shows
> 
> drwxrwxr-x 16   4.0K Sep 27 11:17 
> 
> And ls -alh my-project shows   
> 
> dr-x-- 10   4.0K Sep 27 10:57
>  

These permissions mean  is able to read "r" the contents of the
directory (the list of entries it contains) and make that directory
current, and traverse it - that's what "x" gives when is set on
directories.

As you can see, there's no write, "w", permission which allows to "write
into the directory" - and creating/removing a file is writing into it.

"The trick" about why "w" is needed has to do with the way to make a
so-called "atomic" update of the contents of a file on a Unix system: to
do that, you read the file, _write a copy of it_ with the updated
contents aside with the original one but with a different name and then
perform the rename(2) syscall which renames the file with the updated
contents "over" the original one. rename(2) is guaranteed to be atomic
so that it either happens successfully or fails completely.

> -r-x--  1 23 Sep 27 10:57 

This also won't allow _you_ to update the said file.
Dunno if this is intentional or not, just pointing out.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] error: could not lock config file .git/config: Permission denied

2018-12-03 Thread chiahunglin . ocs
sI find a similar thread[1], but its problem is different from mine. My 
problem is when trying to replace old origin with the new one with the 
command

git remote set-url origin https://...

git complains `error: could not lock config file .git/config: Permission 
denied`. All solutions 
found online suggest changing with `chown`. But that's not the case because all 
dirs under the 
directory with user and group configured are with my account e.g. 

My account is , and group is . Source dir called my-project 
is stored under /path/to/parent-project.

`ls -alh` parent project dir shows

drwxrwxr-x 16   4.0K Sep 27 11:17 

And ls -alh my-project shows   

dr-x-- 10   4.0K Sep 27 10:57 
-r-x--  1 23 Sep 27 10:57 


All are configured with  and  recursively.  

How can I fix this? Anything I may miss that need to check? 

Thanks

My environment: 

- git version 2.7.4

- Ubuntu 16.04 LTS

[1.] 
https://groups.google.com/forum/?fromgroups#!searchin/git-users/error$3A$20could$20not$20lock$20config$20file$20.git$2Fconfig$3A$20Permission$20denied%7Csort:date/git-users/PVagUpsDqCM/_Z4kelXLZ2MJ

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.