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.
To push a new project to an existing GitHub repository, follow these steps: Create a GitHub repository for the existing project. Copy the GitHub URL for the new repo to the clipboard. Perform a git init command in the root folder of the existing project.
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With