Git 执行 git 失败

问题描述 投票:0回答:1

我最近对我的项目进行了更改,删除了一个空文件夹并向我的文件添加了一些更改,但不知何故这些更改没有被提交。请帮助我了解问题的原因和解决方案

Syncing repository: Bhawna-Sharma-9903/my_portfolio
Getting Git version info
Temporarily overriding HOME='/home/runner/work/_temp/3be727ae-7d74-4a4d-aea2-7aefcb4af953' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
/usr/bin/git config --global --add safe.directory /home/runner/work/my_portfolio/my_portfolio
Deleting the contents of '/home/runner/work/my_portfolio/my_portfolio'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Checking out the ref
Setting up auth for fetching submodules
Fetching submodules
  /usr/bin/git submodule sync --recursive
  /usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1 --recursive
  Error: fatal: No url found for submodule path 'my_portfolio' in .gitmodules
  Error: The process '/usr/bin/git' failed with exit code 128

这是我得到的错误块 Git failed to execute git

git commit git-submodules
1个回答
0
投票

错误消息表明在 .gitmodules 文件中没有找到子模块路径“my_portfolio”的 URL

  1. 删除缓存的子模块路径(如果存在):

首先,检查旧的子模块路径是否被缓存。在本地存储库中执行以下命令:

git submodule status

如果存在旧路径,请使用以下方法将其从缓存中删除:

git rm --cached old/path

将 old/path 替换为实际的旧子模块路径。

  1. 创建映射参考(如果不存在路径):

要创建映射引用,请编辑存储库根目录中的 .gitmodules 文件。 添加以下部分(用实际值替换占位符):

[submodule "path_to_submodule"]
path = path_to_submodule
url = git://url-of-source/

path_to_submodule: Actual path within your repository where the submodule will be used (relative to the root).
url-of-source: URL of the original repository containing the submodule’s files.

  1. 仔细检查配置:

更改后,验证子模块路径配置:

git submodule status
  1. 更新子模块:

执行与之前相同的命令来更新子模块:

git submodule update --init --recursive
  1. 提交并推送:

提交更改并将其推送到远程存储库

这些是您可能需要将其修改为存储库结构的一般步骤

参考:在 .gitmodules 中找不到路径的子模块映射并且缺少 .gitmodules 文件(可能有帮助):)

© www.soinside.com 2019 - 2024. All rights reserved.