Wednesday, July 6, 2016

xcode github existing project upload



Open Terminal and switch to the project’s parent folder
to do the initial setup of a repository, open up a terminal window, and CD to the project directory. once there, type


git init
git add . 
git commit -m "Initial commit"


Notice that there’s a period after a space on the end of the second command. Don’t forget to include it.


Confirm your local repositoryReopen Xcode, and hit the ‘Source Control’ menu. You should now see the options are active.





Add a Remote in Xcode

in Xcode go to Source Control > your branch name > Configure. Then click the Remote tab > "+" button > Add remote. Fill in your repository name and address.
enter image description here


Push your project to GitHub

Go to Source Control > Push. You will have to enter your GitHub user name and password the first time.
That's it. Now any time you make changes in Xcode, all you have to do is Commit and Push.



Add a remote repositoryLocal repositories are great, and may be enough for your needs, but for ultimate protection (such as against disk loss or failure), you might want to add remote back up. To do that, you’ll need an account with a service like GitHub or Bitbucket. My own personal preference is Bitbucket, largely because they allow you to have private repositories on a free account. Steps for adding your existing project to a remote repository can be found on your chosen service’s website. If you’re using Bitbucket, the general method is first create a new repository on the Bitbucket site and copy the link. Then, enter each of the following in Terminal, replacing the dummy text in square brackets with your actual values (remove the square brackets, too).
cd [path to your repo]
git remote add origin [url to your repository]
git push -u origin --all
git push -u origin --tags
After that, re-open your project in Xcode and you should be all set up. Check by ensuring the remote path is shown in Source Control > –> master > Configure…

No comments: