How to configure Xcode with BitBucket - ios

I have created a repo. on bitbucket. Now I want to connect that repo to the Xcode 9.So I can directly push, pull and do all the git stuff from Xcode.
is there any way to do that?
thanks!!!

If the project folder is already on your computer, and is already under git control, skip this first step. Otherwise, use the command line, or Xcode's Source Control > Clone dialog, to clone your bitbucket repo onto your computer.
Open the project in Xcode and work with it.
There is no step 3! Xcode will see that this repo is under git control and you'll be able to use Xcode's built-in source control features as usual.

I just spent an hour cajoling Xcode 9.2 into using a new Bitbucket git repo as a new remote. I had trouble adding a new remote using the Bitbucket SSH URL since Xcode assumed my user name is "git" and did not allow me to edit it. Here are some tips in hopes it saves you some time and aggravation. This assumes you are already using Xcode's source control and have made commits locally on your Mac. Make sure your commits are up to date before going through this procedure.
Create a new empty git repo on Bitbucket. Do not create a readme at this point, as this would make your new repo not... empty.
Use the HTTPS address to access your Bitbucket repo from Xcode. Problem is, for an empty repo, Bitbucket does not make it easy to figure out what this address is. For me, it was the same URL Bitbucket shows for SSH access but replacing "git#bitbucket.org:" with "https://user#bitbucket.org/", with user#bitbucket.org (hopefully obviously) YOUR username.
In Xcode, open the Source Control Navigator. This is the second icon from the left in Xcode's left panel next to the folder icon, it looks like a square with an x and a circle in the middle. Right click "Remotes" and select "Add Existing Remote...". Under "Remote Name" enter "origin" or "Bitbucket" or whatever floats your boat and under location enter the https:// URL from step 2.
Now, hooray, in Xcode you can do Source Control->Push successfully.
Thank goodness Apple does all my thinking for me, it saves me from hurting my little brain. Now my only brain trauma is from banging my head against the wall dealing with this kind of nonsense.

You can actually add real Github* account to your Xcode under Xcode/Preferences/Accounts.
This will actually do authentication when you checkout Bitbucket project after that. I guess that they joined user databases.

I had exactly the same problem as You had. To solve it I created a project with a git version control within Xcode 9 and then someone asked me to share it. To do it I created an empty repo on bitbucket, copied its address and then went in terminal to my project's directory.
cd ~/repos/<repo_name>
Once there you just have to write
git push --mirror *copiedRepoAddress
Make sure that the repository you created at bitbucket is EMPTY and that you have commited all changes on your local repo.

Just follow below steps your project will be added automatically to bitbucket.
1.Go to Source Controller ---> create git repository
once click on create option.
2.Open your Bitbucket account and create new repository.And choose i have an existing project.
3.Select your repository address.

Related

How to connect Xcode 9 and GitHub?

I am part of a group of computer science students building their first project in Swift. We have attempted to connect GitHub with the XCode git configurations so we can all edit one project through pushing and pulling commits. We have little to no prior experience implementing GitHub with native applications such as XCode and online articles have not explained how we can create a project in XCode and connect it to GitHub so we can push and pull to Github and edit a 'master project' that we all have access to.
The closest we have gotten is doing XCode -> Preferences -> Accounts and adding new GitHub accounts(ours). However, the project does not show up when we open our GitHubs.
Does anyone know how we can make a collaborative project with GitHub and achieve the above goals? Please frame your answer in the context of us being totally unfamiliar with the process.
Thanks much!
You can put the project on GitHub from Xcode 9's source control navigator. Start by opening the source control navigator by choosing View > Navigators > Show Source Control Navigator or pressing Cmd-2.
Select the Remotes folder, right-click, and choose Create Remote on GitHub. On Xcode 10 the menu item is Create "ProjectName" Remote. A sheet similar to the following will open:
Since you added your GitHub account to Xcode, you can choose the account from the Account menu. If you hadn't added your GitHub account, you would choose Add a GitHub Account and enter your account name and password.
Give your repository a name and add a description if you want. Choose Public for the visibility unless you have a GitHub plan (paid or student) that allows private repositories. Click the Create button and your project will be on GitHub for the other people in your group to clone. They can clone the project by choosing Source Control > Clone.
Create a repository in GitHub (preferably private if you have a paid account) after you create the project head to terminal and navigate to project by:
cd path_to_project
then run these commands
git init
git commit -m "first commit"
git remote add origin https://github.com/UserName/RepoName.git
git push -u origin master
After that you can commit and push from source control menu in Xcode, then every student make a checkout so he can add his tasks and push.

Wrong XCode Project Location After Git Clone

I'm pretty new to Git and Bitbucket etc so am hoping this is something easily fixed although after Googling around I can't find anything similar.
I have an XCode Workspace (project and pod stuff) which I have made a git repository for. I've then created a new remote repository on Bitbucket and pushed the local repository there. So far pretty simple.
I have then gone on to another machine and pulled the repository and here is where I get a problem. In the workspace I can see / expand the Pods but the project is showing with red text and is not expandable.
I had no idea at first why this was but I then noticed that if I left click on the project and look at the identity and type on the right hand side the location is wrong. The path in th epic below is not the path to the project file on the new computer. Instead it is the path to the file on the original computer which was used to push the repo up to Bitbucket.
I've tried changing the location but the best I can do is open the project rather than the Workspace. Ideally I'd be able to change the way it in the original so that the it doesn't need changing in clones but I can't seem to do this in a satisfactory way either.
Any help would be much appreciated.
This is a pretty common problem, usually met when passing projects around
Solution
Press the folder icon under 'Location' and choose the folder the contains your .xcodeproj

Xcode not SVN commit not clickable

I'm having a problem with my Xcode
I set my svn settings in the account settings seems to connect just fine
then I want go to the project I want to commit to the server when I click on source control the only clickable thing is checkout. I tried this like 20 times. It just creates a map with the name of the SVN server that's it.
Does anyone have an idea what I'm doing wrong here?
It seems like you are just creating the appropriate folder for it but not putting your project in it.
Try this. do the checkout again like you already did before, then locate the project you want to sync with your SVN, place it into the folder that was created when you used the "Checkout" function. Now open your project again from within this folder. You should be able to commit/push/pull etc. your project now.
Hope this helps.

Setup git in xcode 5

I've read and finish the tutorial of Git Source Control with Xcode in iOS 7 by Rey Wenderlich.
I know how to use source control on XCode 5. However, I don't know how to setup the repository so that my other MAC unit can access and use it. I'm searching all over google and none I can't seem to find anything that helps me.
Do you have any good tutorials out there for basic repository setup in XCode 5?
After you setted up your repository on XCode you need to push it to a server.
You can use BitBucket for that. Create an account on BitBucket then create a repository there.
For the sake of simplicity, after you create your repository you need to build your https link for your repository. Usually it is in the form :
https://YOUR_USERNAME#bitbucket.org/YOUR_USERNAME/YOUR_REPOSITORY.git
YOUR_REPOSITORY can be checked in the link at the top after you create your repository. Usually that link is in the form https://bitbucket.org/YOUR_USERNAME/YOUR_REPOSITORY.
Then go to your XCode and go to the Source Control and under "Working Copies" select your project then press configure.
After that add your bitbucket repository pressing "Remotes" and then pressing the "+" button and clicking "Add Remote".
The address in the following box is the one : https://YOUR_USERNAME#bitbucket.org/YOUR_USERNAME/YOUR_REPOSITORY.git .
Then do Source Control > Push.
On your other mac go again to the working copies > configure your_project. Add the BitBucket in the remote section and then do Source Control > Pull.

How do I create a bot in Xcode? Getting "Creating a bot requires a project that is under source control."

I'm trying to get Continuous Integration setup in Mavericks using OS X Server for Mavericks.
I have the Server installed and my source code is in a local directory using Git from assembla. I'm following the Apple Xcode Continuous Integration Guide, and I'm at the part where I'm adding a bot to the product in Xcode.
I'm getting the error:
Creating a bot requires a project that is under source control. This project appears to be in a local git repository. To be able to create a bot, the project must be in an repository the server can access so it can clone it. [cancel] [Configure Remotes...]
Clicking either cancel or configure remotes brings up the configure for my folder and I see my remote added just fine. I also tried adding the remote repository again with a different name.
How do I move forward?
It seems like this issue happens when there isn't a remote named "origin", as that's what Xcode is looking for. When I renamed my remote to origin (in <ProjectRoot>/.git/config), Xcode stopped complaining and let me add a bot through the Xcode UI.
This is hacky, but worked.
In Xcode I clicked the Source Control menu then checkout. I checked out my repository to a new folder and I was able to create my bot.
It seems adding the repository from the command line caused things to not look correctly configured to Xcode.
After numerous trials I did the following steps to get the whole process to work:
Connect a device to the server. Make sure it is active.
Set up the server and ensure that the XCode service is active.
Create a new project with a local GIT.
In the Source Control menu, select Configure, and under Remotes select to Create New Remote.
Go to Manage Schemes and check the Shared check box.
Commit the project and select Push to master.
Go to the developer site and create an developer and Ad-Hoc profile.
Go to the Xcode settings and reload the profiles for the team / developer.
Configure this profile in the app build settings.
Select to create a bot with CI to run on commit.
The next time you commit this should run the bot etc.
I had the same issue when I tried to edit a bot that I created before. In my case the problem was that I created the bot for the master branch, but when I tried to edit it, I had checked out a different branch. After switching back to master I was able to successfully edit my bots.
Tried most of the things here. None worked for me. Got this error
Creating a bot requires a project that is under source control..
But when I proceeded with the popup it said
All projects are in workspace (something similar).
I did the below
Removed .git folder
git init
git remote add origin <repo.git>
git pull origin <branch_name>
removed the conflicting folders and files
git pull origin <branch_name>
Then when I clicked create bot from Products it worked.
I think I had the easiest time of all. I simply did an Xcode-based commit and push, then tried the bot again, and the nasty error was gone.
[In Xcode 6.4, this would crash the Xcode].

Resources