Push existing project into Github

后端 未结 18 956
天涯浪人
天涯浪人 2020-12-04 04:25

I have a folder with my project sources. How I can push this project into Github\'s repository?

I tried using this steps:

  1. I created empty repository o
18条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 05:01

    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.

提交回复
热议问题