I've been looking for a solution with Bitbucket and XCode.
As everybody knows, XCode 4.2 comes with git support. I've created a bitbucket account and I wanted to push my changes to my repository,
I've followed this tutorial https://confluence.atlassian.com/display/BITBUCKET/Use+the+SSH+protocol+with+Bitbucket
However this is the problem I'm facing. When I'm in the Organizer - Repositories Section at XCode, I go to my remotes folder and create a repository.
ssh://git@bitbucket.org/username/myrepo.git
However when I'm asked for Name and password, the ones I provide as username and password fails. I've also tried with git as a user but no luck.
UPDATE:
I've created a ~/.ssh/config file where I've added a specific configuration for bitbucket.
Host bitbucket.org
HostName bitbucket.org
IdentityFile ~/.ssh/bitbucket
User username
I've tested it with ssh -T git@bitbucket.org and It works, it gets authenticated.
However, when I test this with XCode I got the following error. "Authentication failed because the name or password was incorrect."
I know I'm missing something here.
UPDATE 2:
I've managed to solve the issue but only from command line, not from XCode. I'll post my solution later but feel free if you have a way to do it from XCode
Thanks
iOS 9.2, Xcode 7.2, ARC enabled
It seems that every time I start a new Xcode project, I have to crawl back to this post and others like it to put together a solution to get my *.git repository set up for the new project. My goal with this answer is to update and compile a full solution. Thanks to all original contributors, especially "trolley".
For a very thorough description, please refer to this link: http://www.appcoda.com/git-source-control-in-xcode/
1. Create your new Xcode project as usual, but make sure that you enable source control, see below:
If you didn't do this, then go here to see how to do it once the project is already created: https://stackoverflow.com/a/17790306/4018041
2. From the top tool bar select Source Control->"current branch"->Configure "your project name", see below:
3. Choose Remotes from the configure menu tab, hit the "+" sign and select "Add Remote", see below:
4. You will be prompted to enter the repository name and enter the address for the repository, see below:
Here you would use the instructions "trolley" provided here: https://stackoverflow.com/a/9271409/4018041
In the above example, "myrepo" is the name of the repository at bitbucket.org; but locally you can assign any name you want, the default name being "origin" as you see in the picture below.
5. Enter the username and password that you use to access your bitbucket.org account, see below:
Your user name is most likely the e-mail you used to register.
6. After pressing OK and if the credentials were accepted, then you should get a green check mark message. That is it!
After this you are able to Source Control->Push your local *.git to your bitbucket.org repository, which is named locally as "origin" (default).
A similar text with a green check mark will appear upon successful push up to the bitbucket.org repository.
Note: Make sure you commit an initial change for the project in order for your local *.git to get properly created.
Hope this helps someone. Cheers!
It worked for me by using the HTTPS URI, but I needed to remove my user name from it. For example change:
https://username@bitbucket.org/username/myrepo.git
to
https://bitbucket.org/username/myrepo.git
then supply your username and password when prompted.
I was able to use the XCode UI by using the https URL and entering my bitbucket username and password when prompted.
Here is an attempt at a full answer…
Create a bitbucket key if you haven't using
ssh-keygen
. Pick a decent name, something likebitbucket_rsa
assuming you create an rsa key. Put it in~/.ssh/
.Once this is created, add:
to your ~/.ssh/config.
Next, add this key to the Bitbucket web interface using the
Manage Account > SSH Keys
tool. To get the public key onto your clipboard use:Finally, make sure you're using the ssh address provided by Bitbucket vs the https one. These look like:
and can be accessed by the drop down labeled HTTPS (currently in the right side bar).
Xcode (including Xcode 5) should now work, as will git from the command line.