Error: Failed to block filepath /../ file configuration. git / config: reject allowed

I created the "try" folder in the path / home / bhishan / Copy / try, then inside this folder I gave several commands:

my teams are as follows:

curl -s -O \ http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain chmod u+x git-credential-osxkeychain sudo mv git-credential-osxkeychain `dirname \`which git\`` git config --global credential.helper osxkeychain git init git remote add origin https: git remote add origin https: git push origin master 

================================

It worked fine, but when I try to delete the try folder, I cannot delete the folder. I also can not give the command:

 git init 

inside the try folder (there is a .git folder there)

==================================================== ===

my command and error report:

 bhishan@bhishan-HP-Pavilion-dv6-Notebook-PC :~/Copy/try$ git init error: could not lock config file /home/bhishan/Copy/try/.git/config: Permission denied 

Now, my question is: how can I delete a folder named "try"?

+10
source share
4 answers

These problems occur when you use sudo to run commands with side effects such as file creation.

It is generally accepted that the files and directories in your home directory are owned by root. In this case, it seems that your .git/config file is owned by root and thus gives you a permission error when trying to lock it.

sudo chown bhishan -R .git from the ~/Copy/try directory should fix the permission problem.

+14
source

I am adding an answer to this question because I got here trying to solve almost the same problem.

There was this problem also in Git. But, as far as I know, the problem is not in the resolution is prohibited, but in the entire application folder. and even if I try to use git in another project, it works fine.

To add @Aaron D's answer, you can use $ (whoami) instead of bhishan. Exactly:

 $ sudo chown $(whoami) ~/Copy/try 

fooobar.com/questions/15324934 / ... link

PS To answer your question:

Now my question is: how can I delete a folder called try?

You can run this command:

 $ sudo rm -rf /home/bhishan/Copy/try 
0
source
 git init 

This worked for me when the .git folder was deleted.

0
source

OS - macOS Mojave 10.14.3

For me, the aforementioned team has done its job. sudo chown -R $(whoami) $(brew --prefix)/*

0
source

All Articles