I have a folder with my project sources. How I can push this project into Github\'s repository?
I tried using this steps:
I will follow the previous comment from Rose P. It took me a long time to find the solution so I'm reposting (hopefully in plain English) what worked for me...
step 1: Create your new repository on Github.com (skip if you already have one)
step 2: Close XCode...not needed
step 3: Open a new Terminal window (yes, you have to use terminal...I tried all other ways...nothing worked)
step 4: Using the command cd to find your folder location to your project (the project you want to add to your existing or new repository)
step 5: type git init you'll get something like this. Reinitialized existing Git repository in /{current directory}
step 6: type git add . nothing happens after this step, but type it and go on to the next step.
step 7: type git commit -m "Initial commit" you'll get the following: # On branch master nothing to commit, working directory clean
or
some explanation about configuration and then a list of files that have changed.
step 8: type git remote add origin {project url} The project url can be found in Github.com. Its the HTTPS clone URL...you should be able to just copy and paste to the terminal window. If the system tell you that origin already exists, create a different name or use your project name (something different)
step 9: go to your GitHub application on your mac and click the "Sync Branch" button (even if there are no pending changes). It takes awhile I think for it to actually commit, but if you go back to your local repository folder you should see your new project. I had to re-create the parent folder, but it's just a matter of moving your files around. Go to GitHub.com and refresh your browser and your new files should also be there.
I hope that helps.
I know, this is an old question but I'm trying to explain every step, so it may help others. This is how I add an existing source to git:
git init
(here you initiate the project as a git one).git add *
(here you add all the files and folders from you project).git commit -m "Initial Commit."
(here you commit your files and folders added in step #4; keep in mention that you can't push your changes without committing them).git remote add origin https://your_username@bitbucket.org/your_username/project-name.git
(here you add a remote project where your source it's gonna be pushed; replace my link with your ssh || https from the step #1).git push -u origin master
(here you push your source into the git repository).Note: Those are simple steps for pushing your source into the master branch.
In summary;
git init
git status
git add "*"
git commit -m "Comment you want"
git remote add origin https://link
git push -u origin master
I would like to share a source with you so that you learn about Git more easily.
https://try.github.io/levels/1/challenges/1
git init
Add the files in your new local repository. This stages them for the first commit.
git add .
Commit the files that you've staged in your local repository.
git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote
repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again. Copy remote repository URL fieldAt the top of your GitHub repository's Quick Setup page, click to copy the remote repository URL.
In the Command prompt, add the URL for the remote repository where your local repository will be pushed.
git remote add origin remote repository URL
# Sets the new remote
git remote -v
# Verifies the new remote URL
Push the changes in your local repository to GitHub.
git push origin master
# Pushes the changes in your local repository up to the remote repository you
specified as the origin
.git
. git remote add origin [your_GitHub_Repository_link]
(remember link should end with .git
)git push -u origin master
Hope this was useful.
Follow below gitbash commands to push the folder files on github repository :-
1.) $ git init
2.) $ git cd D:\FileFolderName
3.) $ git status
4.) If needed to switch the git branch, use this command :
$ git checkout -b DesiredBranch
5.) $ git add .
6.) $ git commit -m "added a new folder"
7.) $ git push -f https://github.com/username/MyTestApp.git TestBranch
(i.e git push origin branch)