In Xcode 4 how do I add a remote GitHub repository to an existing local project?

前端 未结 3 832
礼貌的吻别
礼貌的吻别 2020-12-04 06:26

The Git integration in Xcode 4 is very welcome however it seems to be a bit flaky when it comes to dealing with remote repositories. For clarity I\'m using OS X version 10.6

相关标签:
3条回答
  • 2020-12-04 06:52

    Xcode 6.2 (and possibly 6.x) changed things around. There no longer is a Repositories tab in the Organizer. Here's how to do it with the newer Xcodes.

    To add a project with a local git repository to GitHub, this is what you do:

    1. Go to the Source Control menu, elect your project and select Configure:

    enter image description here

    1. You'll see:

    enter image description here

    1. Select the Remotes tab, and press the "+" in the lower left corner. Select Add Remote.

    enter image description here

    1. Type in a name for the remote repository, and type in the URL for your remote repository. Make sure you've created this remote repository already, and if on GitHub, make are you specify that this is an existing project, and not a new one.

    enter image description here

    1. You're almost done. Go to the Source Control menu and select Push. You will then see the name of the repo you used in the last step, something like "simplest/master"; press the Push button.

    Done.

    0 讨论(0)
  • 2020-12-04 06:59

    I've done this successfully using an ssh connection (which looks like git@github.com:<username>/<project>.git). It authenticates the user based on an SSH public key, which you can generate on the command line--lots of docs about that at github in the "help" section.

    0 讨论(0)
  • 2020-12-04 07:03

    I think I found the Xcode way to push a existing project to GitHub or any other remote repository!

    Preconditions

    • I assume that you have a project created by Xcode 4 with a local git repository.
    • You created an empty remote git repository (I call it RemoteRepository in in the following example)

    Push it to remote

    1. Open the Organizer in Xcode an go to the Repositories tab

    2. At first click on Remotes and then on "Add Remote"

      Xcode Organizer

    3. Enter a Remote Name and the Location of your remote repository and click on create

      Add a remote dialog

    4. Then select your project and open File -> Source Control -> Push ...

      open push dialog

    5. Select your remote repository and wait until it is connectable! Look for the Create in the brackets.

      push dialog

    6. Now your old project is published to GitHub

      result on GitHub

    I hope it will works for you also! In my case it works with every remote git repository.

    Please contact me on twitter if something unclear or wrote in bad English!

    0 讨论(0)
提交回复
热议问题