Copy/Pasting a directory onto my repository!


I'm a newbie to git and SourceTree. I've created a repository and following the steps created a textfile and allready committed and pushed it into the repository. Fine. Now I'm trying to copy/paste a folder containning other folders with the classes i'm trying to write, but... still haven't managed how to do it so! I try direct copy/paste into the working tree but it doesn't seem to work!

Can you guys walk me thought this, please!

Thanx so much in advance!

1 answer

1 accepted

0 votes
Answer accepted

Do those folders have any contents yet (besides other folders)? Git only tracks files, not folders. As far as Git is concerned an empty folder may as well not exist.

Well, actually those folders contain other code files. I want to upload (sorry for that profane expression here) a folder called, in this case, "libraries" with a few folders inside it that contain code files, the classes headers and its implementations (.cpp and .h). But there's none empty folders here. Is that feasible with a copy/paste?


Yeah, that all sounds fine. If you paste files (or folders that contain files) into your working copy, they should show up in SourceTree as untracked files (untracked have a ? icon). From there, they can be added and committed to the repository, then pushed to remotes.

One possible issue - are you pasting folders inside your repository or beside it? In other words, the folder that you are pasting into should have a (possibly hidden) .git folder.

Maybe that could be one of the reasons if this screenshot I'm posting makes any sense to you, cause that's the only answer I get whenever I try pasting a folder or a single file!

I've never seen that patch window before, but I don't think it is related to what you are trying to do.

Try using the commands on this page to make sure hidden files/folders are showing, then post a screenshot of finder in the root of your repository.

You might also try View > Refresh in SourceTree.

I don't know if it's related but it appears when I try dropping stuff on the working tree.

I'm posting the screenshot, in fact you were right; there's a git hidden folder!What should I do with it?

Thanx a lot for your wisdom and patience Seth!

A git hidden folder is good, that means you're in the right place.

Based on your latest comment, it sounds like you are dropping the folder you want to add onto SourceTree itself. I've never done that, but it appears to be trying to do something different than what you want. Try just dropping the folder into your working copy in Finder.

That was the point! (plus I was looking in the wrong folder with the same name but elsewhere... (a lame user like me the biggest bug :-P ).

Thanx a lot Seth! A lot of good karma to you or like we Catalans say (I'll try to translate the expression for you): "God bless you with a few sons but a lot of attempts!"

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,230 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you