def walk_get_gitignore(base_path):
    base_path = os.path.abspath(base_path)
    result = []
    for root_path, dirs_path, files_path in os.walk(base_path):
        for _file_path in files_path:
            if _file_path == ".gitignore":
                file_path = os.path.join(root_path, _file_path)
                abs_file_path = os.path.abspath(file_path)
                result.append(abs_file_path)
    return result
Use os.walk to get all `.gitignore` under base_path
dataset/ETHPy150Open brickgao/specchio/specchio/utils.py/walk_get_gitignore