31

I cloned a repository to my desktop machine using git clone sshurl. As expected, this created a folder in my desktop.

Now, instead of a single file, I want to push a whole folder into git. For example, the folder that I cloned is named project_iphone. Now I add another folder called my_project into project_iphone. The my_project folder contains lots of files and folders as well.

My question is, how should I push my_project folder to the server?

Step-by-step instructions would be helpful.

Thank You.

Bob Gilmore
  • 11,154
  • 13
  • 49
  • 52
da32
  • 673
  • 1
  • 9
  • 17

3 Answers3

48

You need to git add my_project to stage your new folder. Then git add my_project/* to stage its contents. Then commit what you've staged using git commit and finally push your changes back to the source using git push origin master (I'm assuming you wish to push to the master branch).

Gavin
  • 1,193
  • 14
  • 20
  • 1
    it works nicely.....now I've push a folder to git...how do i remove the folder? tried git rm but failed... – da32 Mar 26 '13 at 00:14
  • 2
    never mind already..just needed to add -r..if not can't delete folder...thx for help anyway... – da32 Mar 26 '13 at 09:42
2

You can't push a new empty folder. First you must create at-least one new file in the new folder and then you can add, commit and push it.

Omidreza Bagheri
  • 741
  • 1
  • 10
  • 22
0

You can directly go to Web IDE and upload your folder there.

Steps:

  1. Go to Web IDE(Mostly located below the clone option).
  2. Create new directory at your path
  3. Upload your files and folders

In some cases you may not be able to directly upload entire folder containing folders, In such cases, you will have to create directory structure yourself.

Chan Gaikwad
  • 131
  • 3
  • 12