Reputation: 14161
I am new to Git. I want to add an existing source code folder to Git, but based on the little documentation that I read, I guess files must be a Tar ball or tar.gz archive. I am also not finding a way to add an entire existing folder.
Is it not possible to add non-compressed files to Git repository along with the folder that contains the files?
Upvotes: 38
Views: 63976
Reputation: 2710
In case if you are using Gitkraken then it is the most simplest method.
Steps:
Upvotes: 0
Reputation: 601
It depends what you mean by adding a directory to a Git repository.
I get the feeling that you mean that you want to create a new project using an existing directory. In which case, you would need to go inside your directory and use git init. Here a quick guide I just found.
However, if you mean that you already have a Git project and wish to add a directory - the answer is simply to use git add path
Let us know if you need more information (such as setting up a remote, or using github.)
Upvotes: 48
Reputation: 23921
No, you don't need it compressed. Git operates on the filesystem.
If you want to create a new repository from existing source, just cd into that directory and type: git init
.
Add the current state of files to the index with git add .
(note the trailing dot)
If you want to add existing code to an existing repository, you also need git add
(and probably copy the files to where you repo is).
I suggest to take some time to actually learn and understand git before using, because doing so will save you a lot of trouble.
Upvotes: 23