Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Working With Remote Repositories Cloning

Thomas Williams
Thomas Williams
9,447 Points

"cloned an empty repository" but repository contains files!

Thomass-MacBook-Pro:my_really_cool_project GroupPay$ ls

file1 file2 file3 my_really_cool_project

Thomass-MacBook-Pro:my_really_cool_project GroupPay$ cd ~

Thomass-MacBook-Pro:~ GroupPay$ ls

Applications Downloads Movies MyApplication2 clone_three our_clone_project Desktop Helloworld Music Pictures my_even_cooler_project our_other_clone Documents Library MyApplication Public my_really_cool_project

Thomass-MacBook-Pro:~ GroupPay$ git clone ~/my_really_cool_project/ clone_four Cloning into 'clone_four'...

warning: You appear to have cloned an empty repository.

done.

Thomass-MacBook-Pro:~ GroupPay$ cd clone_four/

Thomass-MacBook-Pro:clone_four GroupPay$ ls

Thomass-MacBook-Pro:clone_four GroupPay$

Why do i keep getting an empty clone when the cloned repository shows to contain files??

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Repository may contain files, but if they aren't added to git repository is empty.

Imagine you have my_really_cool_project GroupPay directory

Then you type : ls

Thomass-MacBook-Pro:my_really_cool_project GroupPay$ ls

There are files, but they are not added to git

When you typed

git init

You initialize new git repository without file

If you type now clone

git clone ~/my_really_cool_project/ clone_four 

Then repository is still empty

In order to fill the repo you first have to add and commit

git add file1
git commit file1 -m "added file1"

This way you will add files to your repository

And then upon cloning there will be files...

Does it make more sense now ?

Thomas Williams
Thomas Williams
9,447 Points

Thanks Alexander, that did indeed solve my problem. I must have missed that step in the tutorial! But now that you have pointed it out, it makes sense. Many thanks.