Php Git clone返回“;错误:无效路径';public/C:\Users\My PC\Documents\Projects\Sample\storage\logs/laravel.log'&引用;

Php Git clone返回“;错误:无效路径';public/C:\Users\My PC\Documents\Projects\Sample\storage\logs/laravel.log'&引用;,php,laravel,windows,git,macos,Php,Laravel,Windows,Git,Macos,我在克隆时收到此错误消息(我有windows,我的同事正在mac计算机上工作): 当我尝试这个建议时,我得到了: >git restore --source=HEAD :/ error: invalid path 'public/C:\Users\My-PC\Documents\Projects\Sample\storage\logs/laravel.log' 我的同事没有问题,但我无法在克隆上传递此错误 请帮助首先检查git ls tree-r master--仅名称返回的内容 如果其

我在克隆时收到此错误消息(我有windows,我的同事正在mac计算机上工作):

当我尝试这个建议时,我得到了:

>git restore --source=HEAD :/
error: invalid path 'public/C:\Users\My-PC\Documents\Projects\Sample\storage\logs/laravel.log'
我的同事没有问题,但我无法在克隆上传递此错误


请帮助

首先检查
git ls tree-r master--仅名称返回的内容

如果其中有一个文件的实际路径为
public/C:\Users
,那么实际上,这将不是一个有效的路径,因此将阻止任何
git restore
尝试

检查是否可以将其删除:

git mv public/C:\Users\My-PC\Documents\Projects\Sample\storage\logs/laravel.log \
  public\Sample\storage\logs\laravel
或者移除它

git rm --cached public/C:\Users\My-PC\Documents\Projects\Sample\storage\logs/laravel.log

最后我找到了原因,因为我的同事推到了git,一些Mac文件被推到了我这边,导致了问题,它们不应该在git-like.DS_-Store文件和.idea目录中


从git中删除它们(1)并将它们添加到gitignore(2)修复了我的问题Alhamdulillah

捕捉得好,比我的答案更精确。向上投票。
git rm --cached public/C:\Users\My-PC\Documents\Projects\Sample\storage\logs/laravel.log