Error when creating .git repository

This is the error that I am getting when creating the repository like in the video. I choose the top folder like I was shown but for some reason it wants an empty one. I guess I’m doing something wrong?

1 Like

I had the same problem! Took a while to figure out. You have a couple choices.

You could just untick ‘create repository on account’, which I assume just makes a local repo that, if you wanted to, would have to manually link to github/bitbucket (I suggest bitbucket as you can make them private for free) etc.

Or if you want to be able to push to github/bitbucket easily, then give it want it wants - an empty folder (in my case that wasn’t enough, it can’t even exist! … you just type the folder name you want in the destination path field for it to create the folder).

You could do that and then start a new unreal project in that folder, or you can rename the folder you already have, do the above to make a new folder with the original folder name, then cut and paste the contents into the new folder.

I also suggest for a good gitignore, that seems to cover everything. But it was good to learn how to do a basic version of it in the video. You’ll have to modify it if your .git folder is outside of your unreal project folder - like what Ben does.


I did the second option. Made some empty folder, got the hidden .git folder and moved it into my project folder. It seems to be working now.

Thanks for the question and the answers! I had this problem and resolved it by taking the advice of not creating the empty folder, but simply typing the name into the field for Sourcetree to make the directory for me.

Hi Ben,

Good to see you guys worked it out. I stil have the same problem going on for 2 hours now and I can’t move on now… I tried the above steps but I keep getting this vague error:

SourceTree was unable to create local repository
"fatal: cannot mkdir M:\Documents\Unreal Projects\Unreal Course projects\section_3": Invalid argument"

So I tried removing it all and creating a new folder, and let it make a new folder (just called it Section3ST for now) via the destination path field for it to create the folder by itself. I get a step further, it creates it but then I get the above error… I don’t get what the invalid argument means.

Can you help me out?
And it is ok to move the hidden git folder to the section 3 folder where it should have gone by cut and pasting it there?

Hi Chris,
Are you on Windows or Mac? I have both, so I could try to troubleshoot
When I get home I’ll hop on and see if I can help.

Hi Ben,

Thank you for the quick reply!
I am on Windows. I kept on playing with it and figured it out.
For others that might run into the same problems I’ll write down what I did:

After several more tries I did the customer service thing by just restarting the system…
And there we go… it did not give that second error. I know right… weird!

Then I cut and pasted the (hidden) Gitignore folder into the section 3 folder, so it stands where it should be.
When I re-opened SourceTree it complained of course, so I told it to change the folder to the new location and pointed at the right folder. Surprisingly, it does this easily without complaining or argumenting :wink:

That’s it! It works now, I filled out the ignore list and now I can follow the course again. Let’s hope we do not keep running into these kind of stupid issues. Guess only bug fixing will be a big chapter of our time but not installing more software. I want to thank you anyway for offering help!


Hi all

Just had a sim’ issue, read through every post and considered giving source tree admin options on execute (right button menu and then tick the bottom option), it worked :slight_smile:


I second the running Sourcetree as administrator option. Finally worked for me.

This did not work for me. Unfortunately, it seems that SourceTree has changed significantly since Ben recorded this course, and so I went a completely different route altogether.

Basically, follow the steps in this video to the letter, and it will help you at least understand version/source control, which I think is Ben’s goal anyway.

Some things about it will be quite different than in SourceTree, but I found Github Desktop to be much more reliable and easier to use. Plus, it actually works!

Beware, however, that I haven’t gotten much further in the course than setting up SourceTree, so I’m not sure how much this might change the course’s goal, if at all. I can report back in a few hours and let people know!

1 Like

OK, here’s what I’ve learned so far about UE’s built-in Source Control.

  • When you go to set up for the first time, the very first thing you should do is edit the .gitignore file so that you can add Content/StarterContent. As long as you create your content inside of the parent Content folder, you’ll be good, but try to limit as much media as possible being committed.

  • When you go to make your first commit inside of the Github Desktop app, do not push to the master branch first. Instead, go to the far-left pane of the program, click on “Changes”, then make sure that you have your Sources folder selected. Make sure your first C++ files are there. If you commit before verifying this, it will make it extremely difficult to add it in the future, at least in my experience.

  • Once you have verified that what you want to commit is selected, in the “Summary” field put your title, i.e, “Fist Commit”, and in the description field put what you deem pertinent. When yo do that, you should be able to click the blue button at the bottom, “commit to master”.

  • Finally, after you have done that, click the “push to master” (it may also say “push to origin”) button located in the top middle of the program. It should have a “1” in a grey circle by it, letting you know there is a commit to push.

And there you have it! As far as I can tell it works better and far more simply than SourceTree, and it’s really easy to set up so long as you follow the video I linked originally. If you have any questions, feel free to ask and I will answer! I can post photos later is anyone wants me to.

Privacy & Terms