简体   繁体   English

Git在Windows上提交无效字符

[英]Git commit with invalid character on Windows

I got a Git repository that I accidentally pushed a file 4 commits ago that is located in (path relative to the repository root folder): /Core/C:/testoutput/agwqe1s.xml 我有一个Git存储库,我意外地推送了一个文件4提交之前位于(相对于存储库根文件夹的路径):/ Core / C:/ testoutput / agwqe1s.xml

I did this on my Linux machine, so the actual file was created without any problem. 我在我的Linux机器上做了这个,所以实际创建的文件没有任何问题。 The thing is when I go back to my Windows machine, I can't switch to the branch that has this file because the Windows just refuses to create such a folder. 问题是当我回到我的Windows机器时,我无法切换到具有此文件的分支,因为Windows只是拒绝创建这样的文件夹。 Ok, no problem, I deleted the file on my Linux end and commit it, but even tough it's not working. 好吧,没问题,我在Linux端删除了文件并提交了它,但即使很难,它也无法正常工作。 Git still tries to create this illegal file on my Windows machine, and I don't know what to do. Git仍然试图在我的Windows机器上创建这个非法文件,我不知道该怎么做。

I know that I could remake the repo from scratch, but then I'd lost my whole commit log history, and I wanted to avoid that. 我知道我可以从头开始重制repo,但后来我丢失了整个提交日志历史,我想避免这种情况。 What are my options over here? 我在这里有什么选择?

you don't need to checkout that branch to update it. 您不需要签出该分支来更新它。 From a branch that works do this: 从一个工作的分支执行此操作:

git fetch
git push . origin/problembranch:problembranch
git checkout problembranch

the trick is to push to the same repository. 诀窍是推送到同一个存储库。 That's what the . 那是什么的. is for. 是为了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM