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.
Related
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.
In Xcode 7, after creating a new remote branch using Jira/Stash, when I pull master, the new branch used to show up as an optional origin branch. Now newer branches don't show up at all, so creating a new local branch isn't as easy.
Before you could go to Source Control > hover over your current working copy > select "Switch to Branch" and scroll to see the new origin/ branch. Once that was selected, Xcode automatically created a local branch.
Now I have to manually name/create a new branch locally and push it up (Create) the remote branch which can cause a lot of conflicts if you're working copy isn't master.
Is there a way to force Xcode to see all the remote branches via the Terminal, or by something I'm missing in Xcode?
Ok, so as of Xcode 7.1.1, it looks like the way to do this is to:
1) Create your branch in Jira/Stash
2) In Xcode, go to Source Control
3) Select "Pull"
4) Click on the dropdown and you'll see the new "origin/..." branch
5) select the new branch and pull
6) go to Source Control, hover over your working copy, and select "Switch to Branch..."
7) find the new origin branch in the origin section and you'll create a new local branch
Some IDEs like Visual Studio may require you to pull "master" to get the new origin branches, but this seems to be the way it's done now in Xcode.
UPDATE: It appears I didn't have "Refresh server status automatically" checked which would eliminate most of these steps! (found in Xcode -> Preferences -> Source Control .. unless this was recently added in Xcode 7.3)
Now you need to tick Fetch and Refresh Status
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.
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].
In xcode 4 organizer there was a button "import", in xcode5 how do I import a project in my svn repository?
thanks
The question is a bit confusing so please advise if it's not exactly what you need (otherwise, feel free to accept the answer). The confusion is that the Xcode 4 workflow you describe is used to allow developers to manage repositories (svn or git). If you want to take an Xcode project and add it to an existing svn repository I am attaching links to answers for that question.
Adding Xcode Projects to SVN:
Stack overflow response
SVNBook
High-level Concepts (Xcode 4 Workflow in Xcode 5):
Tell Xcode 5 about a repository (it will auto detect the type of svn
or git)
Check-out the repository for insertion into a different project
Background:
In Xcode 4.6.3 there was a repository area of the organizer. This is where subversion and git projects were managed.
New Workflow:
The new location for this information in Xcode 5 is in Xcode > Preferences > Accounts > Repositories (menu on the left) > (+) Add Repository... (on the lower left)
Once selected one may enter a repository address (local or external):
And give the repository a directory name (credentials for many public read only repos are optional):
With Xcode 5, one can then download the repository to a target folder by going to menu Source Control > Check Out...
As part of the checkout wizard one will be authenticated to the repository:
Select a target folder to store the local repo:
Edit basic repo properties:
For more information on adding projects to repositories:
Xcode 5 Source Control Management Documentation
As far as I can see, you need to know the exact path to be able to check out a project. This seems like a step backwards.