初始提交:"致命:无法创建......"的主要目录

时间:2014-04-22 08:56:11

标签: git github unity3d

我正在尝试在GitHub上为Unity项目初始提交git存储库。我跟着this guide跟着去了我所在的地方。注意:出于某种原因,我无法将Unity的资产序列化模式设置为强制文本,因此我决定使用Mixed(我认为应该可以使用)。

当我打电话给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)
$ 

我搜索了解决方案,但我发现的任何内容似乎与我得到的原因相同。对此的帮助非常感谢!

3 个答案:

答案 0 :(得分:1)

看起来好像你有两个问题。

首先,您需要一个.gitignore文件来正确限制您添加到Git的文件。您在链接的教程中对此进行了介绍,但您似乎未正确遵循此操作(因为您的add包含Temp文件夹中的文件)。查看您的文件列表,您似乎只是意外地命名了此文件.gitignore.txt。删除文件扩展名,然后重新尝试重新启动(重新运行git add),您将获得更好的结果。

clone的问题在于您的第二个参数(路径".")不正确。它不是必需的(默认情况下都是.),如果你想指定它,那么存储库之后,而不是之前(参见the Git docs }有关详细信息 - <repository>来自<directory>)。

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

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

答案 1 :(得分:0)

我在MacOS上也遇到过这个问题。原来SourceTree试图克隆到我的/ Developer / Projects文件夹。这是一个系统文件夹。我改为其他文件夹,但它确实有效。

答案 2 :(得分:0)

我有同样的错误。保持紧密团结,就可以出发了