git 初始提交:“fatal:could not create leading directories of ...”

bgtovc5b  于 12个月前  发布在  Git
关注(0)|答案(4)|浏览(481)

我正在尝试为一个Unity项目在GitHub上的git仓库进行初始提交。我使用了沿着this guide来达到我的目的。注意:出于某种原因,我无法将Unity的Asset Serialization Mode设置为Force Text,所以我选择了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)
$

字符串
我寻找解决办法,但我发现似乎没有什么与我得到的相同的原因。在这方面的帮助是非常感谢!

o4tp2gmn

o4tp2gmn1#

看起来你有两个问题。
首先,你需要一个.gitignore文件来正确地限制你要添加到Git中的文件。(因为您的add包含来自Temp文件夹的文件)。查看文件列表,看起来你只是不小心把这个文件命名为.gitignore.txt。删除文件扩展名,然后重新启动(重新运行git add),你会得到更好的结果。
clone的问题是第二个参数(路径".")不正确。它不是必需的(默认值是.),如果你想指定它,它在仓库之后,而不是之前(详见the Git docs-<repository><directory>之前)。
所以,我认为你的克隆应该是这样的:

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

字符串

bvn4nwqk

bvn4nwqk2#

我也有同样的错误。只要紧密团结,你就可以出发了

qvtsj1bj

qvtsj1bj3#

我也有一次在MacOS上遇到这个问题.原来SourceTree试图克隆到我的/Developer/Projects文件夹.这是一个系统文件夹原来.我改变了一些其他文件夹,它的工作.

pxiryf3j

pxiryf3j4#

运行php-fpm(或您的容器名称)容器的命令:

docker-compose exec --user=root php-fpm bash
chown www-data:www-data -R /home/www-data

字符串

相关问题