Copy/Pasting a directory onto my repository!
Asked by Oscar Martinez Carmona:

Hi!

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!


Answers:
author: Seth
body: 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.

comments: author: Oscar Martinez Carmona
body: 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?

Thanx!


author: Seth
body: 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.


author: Oscar Martinez Carmona
body: 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!

![](../../upfiles/Captura_de_pantalla_2014-04-01_a_la%28s%29_15.33.32.png)


author: Seth
body: 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](https://coderwall.com/p/cqlvta) to make sure hidden files/folders are showing, then post a screenshot of finder in the root of your repository.


author: Seth
body: You might also try View \> Refresh in SourceTree.


author: Oscar Martinez Carmona
body: 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!


author: Seth
body: 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.


author: Oscar Martinez Carmona
body: 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!"