I have a project which I have been on for ages which is not connected to any source code repository.
I want to start using BitBucket now, however I am not sure how to go about it. I have created a project in BitBucket.
Should I now clone and check out in Xcode or should I add a repository in xcode. Anyone have any idea?
I have tried cloning using the URL from bitbucket but it just comes back with an error in Xcode
I've met the same problem and here's how I solved it:
(Assume your project is not already under local source control) Create a new project under LOCAL source control (Please note that adding remote source control at this stage may not be successful)
Make this new project a clone of your old project - drag files, add frameworks, etc.
In menu "Source Control" -> -> "Configure " In the new window, click on "Remotes" -> "+" -> "Add Remote"
Name: anything (you can use "BitBucket")
Address: https://accountname@bitbucket.org/accountname/reponame.git
"Source Control" -> "Commit"
Select "push to remote" at the left bottom corner
Click "Commit"
Check on BitBucket website to see if it's actually pushed to it
Using the following URL structure
(Taken from here) did the job for me
It is easier to:
~/.ssh/config
): seegit push myrepo origin master
" to initiate the first pushI use SourceTree and Xcode 6.1 and in my case I first create a repository on bitbucket, then I clone my repository on an empty folder (using SourceTree or via command line) then when you create the new project on XCode in that folder, you can commit push and pull normally from XCode
I did that through command line and it is fairly straightforward.
go to command line, cd to your xcode project directory, and the follow the bitbucket doc: https://confluence.atlassian.com/display/BITBUCKET/Import+code+from+an+existing+project
go back to xcode and you should be able to interact with bitbucket through xcode from this point on
As of 2017, xCode now automatically creates repositories for new projects. To push to a new BitBucket repo, go to 'Source Control' > 'Commit...' in xCode and make your first local commit.
Next open a terminal and navigate to to the top-level directory of your project. If you
ls -a
in here you should see the.git/
directory has been created. In the same directory, add your remote repo with the following (replace with your username/team name and repo name):Go back into xCode, go to 'Source Control' > 'Push...'. You'll be prompted to enter your BitBucket password. Press OK and you're done! Source control commands will now be working within xCode.