首页 > 解决方案 > 为什么 Git 会在我的文件中放入随机字母?

问题描述

我正在尝试在运行 Ubuntu Server 的 Raspberry Pi 上托管 Discord 机器人。我正在尝试通过将文件上传到 GitHub 存储库(公共)然后让 Raspberry Pi 拉取更改来对其进行更新。我先采取这些步骤L

git init
git add .
git commit -m "test"
git branch -M master
git remote add origin (MY_PUBLIC_REPO_LINK)
git push origin master

没关系。然后我运行我的 Jishaku pull 命令......它给了我这个错误:

[stderr] warning: Pulling without specifying how to reconcile divergent branches is
[stderr] discouraged. You can squelch this message by running one of the following
[stderr] commands sometime before your next pull:
[stderr] 
[stderr]   git config pull.rebase false  # merge (the default strategy)
[stderr]   git config pull.rebase true   # rebase
[stderr]   git config pull.ff only       # fast-forward only
[stderr] 
[stderr] You can replace "git config" with "git config --global" to set a default
[stderr] preference for all repositories. You can also pass --rebase, --no-rebase,
[stderr] or --ff-only on the command line to override the configured default per
[stderr] invocation.

我谷歌它,他们告诉我使用 ff-only 标志。好的。然后,我再次运行命令,出现此错误:

[stderr] From https://github.com/ConchDev/ConchBot
[stderr]  * branch            master     -> FETCH_HEAD
[stderr] fatal: refusing to merge unrelated histories

[status] Return code 128

这就是问题开始的地方。如果我使用强制合并不相关的历史标志,我会在我的文件底部得到这样的东西:

>>>>>>> 699b4f2ba544a5047f22ba6a42b2df5d79635eb4

它把它放在我每个文件的末尾,引发语法错误并拒绝启动程序。我不知道如何解决这个问题,我和我的朋友一直在寻找解决方案。这里有人可以帮忙吗?

标签: git

解决方案


推荐阅读