6

I am trying to make the initial commit to a git repository on GitHub for a Unity project. I followed along with this guide to get to where I am. Note: For some reason or another, I couldn't set Unity's Asset Serialization Mode to Force Text, so I settled on Mixed (which I believe should work).

When I call git clone --bare . , I get an error.

Note that I am not the creator of the repository and only a contributor (though I am making the initial commit).

Here's everything in my terminal (I'm using 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)
$ 

I searched for solutions to this, but nothing that I found seemed to have the same cause as what I am getting. Help on this is much appreciated!

1
  • zarazha is not your own github account, correct? But you have write permission to the swarch repository? Commented Apr 22, 2014 at 11:16

4 Answers 4

3

It looks as though you have two issues here.

First, you need a .gitignore file that correctly limits the files you're adding to Git. This is covered in the tutorial you linked, but it seems you've not followed this correctly (as your add is including files from the Temp folder). Looking at your file list, it seems you've just named this file .gitignore.txt by accident. Remove the file extension and then try starting again (re-run the git add) and you'll get better results.

The problem with your clone is that your second argument (the path ".") is incorrect. It's not required (the default would be . anyway), and if you do want to specify it, it comes after the repository, not before (see the Git docs for details - <repository> comes before <directory>).

So, I think your clone should instead just be this:

git clone --bare https://github.com/zarazha/swarch.git
1
  • That solved the problem. I forgot to get rid of the file extension! Also, I had no idea what the dot after the --bare was for, so I just included it like the tutorial showed. Thanks a lot!
    – Cheddar
    Commented Apr 23, 2014 at 5:16
2

I have the same error. Just close unity and you are ready to go

0
0

I also had this problem one time on MacOS. Turns out SourceTree was trying to clone to my /Developer/Projects folder. This is a system folder turns out. I changed to some other folder and it worked.

0

Run commands for php-fpm(or your container name) container:

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.