PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, May 14, 2022

[FIXED] How to add directory recursively on git safe.directory?

 May 14, 2022     bash, cve-2022-24765, git, ubuntu     No comments   

Issue

According to this QA, we may use safe.directory argument to add directory to be marked as whitelist, due to latest CVE found on git. But it seems there is no way to add certain dirs recursively.

I have so many repositories to add, so i want to use recursive add instead, if the feature is exist. The repositories mostly placed on my mounted NTFS disk on ubuntu, so the owner of files inside is always root. Looks like the latest update restricts git operations if the logged in user is not match with owner of the git directory by showing error such fatal: unsafe repository ('/media/data1/project1/si/project' is owned by someone else.


Solution

What I did for now, but may not be the perfect solution, is to find all .git folders and add them through a find command.

find /full/path -name '.git' -type d -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \;

Want to remind, that it is necessary to add the full path in the find command, so it will resolve the full path.



Answered By - ersatzhero
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing