Aditya J Gupta Aditya J Gupta - 22 days ago 6
Git Question

How to clone a folder on a PC on Github

I'm new to git. I'm finding it hard to figure out how (if possible) can I copy a folder (along with its sub-folders) over to a git repository either using the bash or the web interface while maintaining the folder structure

Answer

First you should clone your repository to xxx-subfolder:

git clone <repository-URL> xxx

Now you copy your folder to xxx folder.

Add the folder to git repository:

git add .

Commit the change:

git commit -m "New folder is added"

Push the change to remote git server:

git push