Che*_*dar 6 git github unity-game-engine
我正在尝试对 Unity 项目的 GitHub 上的 git 存储库进行初始提交。我按照本指南到达了我所在的地方。注意:由于某种原因,我无法将 Unity 的资源序列化模式设置为强制文本,因此我选择了混合(我认为应该可行)。
当我调用 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)
$
Run Code Online (Sandbox Code Playgroud)
我寻找了解决方案,但我发现的原因似乎与我所得到的情况不同。非常感谢对此的帮助!
看起来你这里有两个问题。
首先,您需要一个.gitignore能够正确限制要添加到 Git 的文件的文件。您链接的教程中介绍了这一点,但您似乎没有正确遵循这一点(因为您add包含Temp文件夹中的文件)。查看您的文件列表,您似乎只是.gitignore.txt偶然命名了该文件。删除文件扩展名,然后尝试重新启动(重新运行git add),您将获得更好的结果。
您的问题clone是您的第二个参数(路径".")不正确。它不是必需的(无论如何默认值都是.),如果您确实想指定它,它位于存储库之后,而不是之前(有关详细信息,请参阅Git 文档-<repository>位于之前<directory>)。
所以,我认为你的克隆应该是这样的:
git clone --bare https://github.com/zarazha/swarch.git
Run Code Online (Sandbox Code Playgroud)