gpt4 book ai didi

git - 初始提交 : "fatal: could not create leading directories of ..."

转载 作者:行者123 更新时间:2023-12-04 13:49:41 28 4
gpt4 key购买 nike

我正在尝试为 Unity 项目对 GitHub 上的 git 存储库进行初始提交。我跟着this guide到我所在的地方。注意:出于某种原因,我无法将 Unity 的 Assets 序列化模式设置为强制文本,所以我选择了混合(我认为应该可行)。

当我调用 git clone --bare 时。 ,我收到一个错误。

请注意,我不是存储库的创建者,而只是贡献者(尽管我是在进行初始提交)。

这是我终端中的所有内容(我使用的是 Git Bash):

Welcome to Git (version 1.8.4-preview20130916)


Run 'git help git' to display the help index.
Run 'git help <command>' to display help for specific commands.

Cheddar@CHEDDAR-PC ~
$ cd Documents/ICS168Swarch/

Cheddar@CHEDDAR-PC ~/Documents/ICS168Swarch
$ git init
Initialized empty Git repository in c:/Users/Cheddar/Documents/ICS168Swarch/.git
/

Cheddar@CHEDDAR-PC ~/Documents/ICS168Swarch (master)
$ git add .
warning: LF will be replaced by CRLF in Assets/Prefabs.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Prefabs/Pellet.prefab.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Prefabs/PelletManager.prefab.meta
.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Prefabs/Player.prefab.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scene1.unity.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts/EatPellets.cs.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts/EatPellets.cs.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts/Movement.cs.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts/Movement.cs.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts/SpawnPellets.cs.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Assets/Scripts/SpawnPellets.cs.meta.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Library/ScriptAssemblies/CompilationComp
leted.txt.
The file will have its original line endings in your working directory.
error: open("Temp/UnityLockfile"): Permission denied
error: unable to index file Temp/UnityLockfile
fatal: adding files failed

Cheddar@CHEDDAR-PC ~/Documents/ICS168Swarch (master)
$ git commit -m "[Initial project setup]"
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore.txt
# Assembly-CSharp-vs.csproj
# Assembly-CSharp.csproj
# Assembly-CSharp.pidb
# Assets/
# ICS168Swarch-csharp.sln
# ICS168Swarch.sln
# ICS168Swarch.userprefs
# Library/
# ProjectSettings/
# Temp/
nothing added to commit but untracked files present (use "git add" to track)

Cheddar@CHEDDAR-PC ~/Documents/ICS168Swarch (master)
$ git clone --bare . https://github.com/zarazha/swarch.git
fatal: could not create leading directories of 'https://github.com/zarazha/swarc
h.git'

Cheddar@CHEDDAR-PC ~/Documents/ICS168Swarch (master)
$

我为此寻找了解决方案,但我发现的任何东西似乎都与我得到的原因相同。非常感谢这方面的帮助!

最佳答案

看起来你在这里有两个问题。

首先,您需要一个 .gitignore正确限制您添加到 Git 的文件的文件。这在您链接的教程中有所涉及,但您似乎没有正确遵循这一点(因为您的 add 包含来自 Temp 文件夹中的文件)。查看您的文件列表,您似乎刚刚将这个文件命名为 .gitignore.txt意外地。删除文件扩展名,然后尝试重新开始(重新运行 git add ),您将获得更好的结果。

您的问题 clone是您的第二个参数(路径 "." )不正确。它不是必需的(无论如何,默认值都是 .),如果您确实想指定它,它会出现在存储库之后,而不是之前(请参阅 the Git docs 了解详细信息 - <repository> 出现在 <directory> 之前)。

所以,我认为你的克隆应该是这样的:

git clone --bare https://github.com/zarazha/swarch.git

关于git - 初始提交 : "fatal: could not create leading directories of ...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23214892/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com