2

I am trying to connect Xcode with Git (Bitbucket).

I read this question/"tutorial": In XCode 4 how do I add a remote GitHub repository to an existing local project?

I follow all steps but I have a problem.

In Xcode 4.6.1 I always obtain this error:

"fatal "my_Repo" does not appear to be a git repository fatal: Could not read from remote repository."

What can I do? I am very noob with XCode.

Thanks!

Community
  • 1
  • 1
Kaisser
  • 93
  • 3
  • 8

2 Answers2

1

This is usually linked to the Bitbucket url you are using for your remote repo.

I prefer using at first an https url (not a git one, or an ssh one), as listed in this BitBucket doc page:

https://accountname@bitbucket.org/accountname/reponame.git

Make sure your repo name and user name are correct, including their case.

The problem is on Xcode, at the moment to make the "Push". Xcode always shows: "Commit or discard the changes and try again." And isn´t true, there aren´t changes

As in this answer, you need to add and commit at least one change in order to be able to push.

The OP Kaisser mentions this tutorial "12 steps to using GitHub with XCode 4".
What he did was:

create an empty project and make the commit and the push, all OK.
Then, I copied my current project and renamed it

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Also, make sure your project is under source control. – SevenBits Mar 25 '13 at 11:05
  • Hello all. The url is right and ... I will search in google how to verify that my project is under source control. Thanks – Kaisser Mar 25 '13 at 12:09
  • @Kaisser any change for us to see what url you did use? And which step exactly is the one causing your error message? – VonC Mar 25 '13 at 12:10
  • Hi VonC, I can´t understand you very well :( I have the repo on Bitbucket and I can do commit with console. The problem is with XCode. When I try to make a "Push" Xcode always shows an error: "Commit or discard the changes and try again." :S – Kaisser Mar 25 '13 at 12:36
  • @Kaisser what is the url you are using for your repo on BitBucket? What step is causing problem? – VonC Mar 25 '13 at 12:38
  • The repo is: https://thefactbitbucket@bitbucket.org/thefactbitbucket/pruebaxcode.git And the problem is on Xcode, at the moment to make the "Push". Xcode always shows: "Commit or discard the changes and try again." And isn´t true, there aren´t changes – Kaisser Mar 25 '13 at 12:40
  • Like this: http://stackoverflow.com/questions/11910228/cannot-push-pull-or-merge-git-working-copy-has-uncommited-changes?rq=1 – Kaisser Mar 25 '13 at 12:51
  • @Kaisser so you need to add and commit first with XCode, *then* push. – VonC Mar 25 '13 at 12:53
  • Yes VonC, I can make the "commit" with this steps: Step 0: git status Step 1: git rm --cached ProjectName.xcodeproj/project.xcworkspace/xcuserdata/username.xcuserdatad/UserInterfaceState.xcuserstate Step 2: git commit -m "Removed file that shouldn't be tracked" But, now I obtain another problem: "fatal: 'WTF_App' does not appear to be a git repository fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists" Is the problem that I talked in my first question. How can I solve it? Thanks! – Kaisser Mar 25 '13 at 13:05
  • @Kaisser What does `git remote -v` returns? and `git branch --all`? – VonC Mar 25 '13 at 13:07
  • git remote -v returns nothing and git branch --all * master. What means? :/ Thanks! – Kaisser Mar 25 '13 at 13:45
  • @Kaisser That means you are on the `master` branch (which is good), but git push wouldn't know *where* to push to, since no remote is registered. Try, as in https://confluence.atlassian.com/display/BBKB/fatal%3A+'origin'+does+not+appear+to+be+a+git+repository, to add a remote origin: `git remote add origin https://thefactbitbucket@bitbucket.org/thefactbitbucket/pruebaxcode.git` – VonC Mar 25 '13 at 13:49
  • @Kaisser is `WTF_App` directory is in the `pruebaxcode` directory? You need to have `pruebaxcode` cloned locally and version `WTF_App` directory in it, for `WTF_App` to be in a git repository. – VonC Mar 25 '13 at 19:26
  • I think I have problems with directories. What´s the right sctructure?. I will try to do a test-project and connect to my repository. Thanks – Kaisser Mar 26 '13 at 07:56
  • @Kaisser If you clone a repo `pruebaxcode`, you must see a `pruebaxcode/.git`. Any project supposed to be in source control should be `pruebaxcode` directory or sub-directory. – VonC Mar 26 '13 at 07:57
  • Solved! I follow this tutorial step by step: http://www.mindthe.net/devices/2011/04/28/12-steps-to-using-github-with-xcode-4/ I create an empty project and make the commit and the push, all OK. Then, I copied my current project and renamed it. THANKS! – Kaisser Mar 26 '13 at 08:27
  • @Kaisser Excellent. I have included your link in the answer for more visibility. – VonC Mar 26 '13 at 08:29
0

I am seeing a similar issue, starting today. I haven't made any commits or pushes to my BitBucket repo in about 2 months, but I never had issues before. XCode is now telling me that the repository "could not be reached" and to "Please verify that the repository is online and reachable and try again". I can commit from the command line. I wonder if this is an XCode 4.6.1 bug?

PS - not sure if I put this in the right place. I've never posted on SO. Correct me if I did this wrong!

Paul Brown
  • 23
  • 5
  • Welcome! Because Stack Overflow is for questions and answers, try upvoting the question to show interest and support. Then you can leave more information as a comment below the question. Right now, you have left this as an answer to the problem. :) – CoffeeRain Mar 25 '13 at 18:06