首页 > 解决方案 > 从 C++ 程序调用 git clone

问题描述

我正在尝试从 Windows 中的 C++ 程序调用“git clone”,为此我创建了一个空文件夹(使用 std::filesystem::create_directory 和 _chdir),然后我以这种方式使用 CreateProcessW:

::CreateProcessW(std::wstring(fullPath.begin(), fullPath.end()).c_str(),
                            const_cast<LPWSTR>(std::wstring(fullArgs.begin(), fullArgs.end()).c_str()),
                            nullptr,
                            nullptr,
                            TRUE,
                            _createNewConsole ? CREATE_NEW_CONSOLE : 0,
                            nullptr,
                            std::wstring(_path.begin(), _path.end()).c_str(),
                            &siStartInfo,
                            &piProcInfo);

但是当我这样做时,Git 会返回以下错误消息:

fatal: could not create work tree dir 'XXXX': Permission denied

但是,由于我自己创建了文件夹,所以我不确定是什么问题
文件夹权限如下:

drwxr-xr-x

知道如何解决吗?

标签: c++windowsgit

解决方案


尝试

chmod -R 777 你的文件夹


推荐阅读