Git 克隆工作,推送失败相同的 URL 来自 php



我正在运行以下命令:

$Command = "https://user:password@mydomain.com/MyGit/code.git";
exec("git clone " . $Command);
//copy a file into the cloned repository
exec("git commit -am "files added"");
exec("git push " . $Command);

除了导致此错误的最后一行外,所有工作正常:

远程:用户名或密码无效。

致命:https://user:password@mydomain.com/MyGit/code.git身份验证失败

我想知道发生了什么,因为相同的用户密码组合可用于克隆,并且我是存储库的所有者,因此为"用户"授予读/写访问权限。

不想设置外部安全密钥,我只想通过HTTPS进行简单的用户密码身份验证。

尝试使用以下方法进行 git 推送:

exec("git push origin master");

基本上,URL 地址在项目的 .git/config 文件中保存为对源存储库的引用。

最新更新