How to import git project into Xcode 8? - xcode

I have C++ make project on the git but I can't import it into Xcode. I clicked "check out an existing project" and then choose repo and enter username passwords then select branch and download path. At the end it opens folder of project then I clicked finish, thats it nothing happens.
When I open an empty project, I can see the git project on the "source control" tab but I can't import it. Can you guys help me?
Btw: I am deeply regret to buy mac.

To import a git repo into XCode 8 you just need to go to SourceControl -> Check Out...
There in the enter a repository location text field enter the full path of the git repository (e.g., https://github.com/your-log-in/repo-name.git
Then you will be prompt about where to save the local files, and you are good to go

Related

Xcode's "branches" master is an incorrect project

I want to put my current project on GitHub, but within my Source Control Navigator, it shows Branches. After double clicking the Initial Commit within master, it's showing a different project than what is currently open on Xcode.
Eventually I want to put the Xcode project on GitHub, but even if I try, it puts whatever is in master, which is incorrect. How do I fix this?
Edit:
It took a few Terminal commands, and then I was able to go to the Source Control menu >> Commit without errors.
xcrun git config --global user.email you#whatever.com
xcrun git config --global user.name "Your Name"
This put the correct version of the project on GitHub after I created a remove. Unfortunately, my master(current) is still incorrect and it includes that on GitHub for some reason.
Here are some screenshots of my Source Control Navigator. I only want first master displayed in the root folder or remote >> origin. Within the Branches folder, the only master shown is incorrect.
I moved a hidden ".git" (system) folder outside my main project folder. I then could create a new repository within the Source Control Navigator, create a new remote and the appropriate projects are visible in GitHub.

Xcode 5, Export Project to SVN repository

In previous version of Xcode there was a repository section in Organiser which is now missing in Xcode 5. How to export project to SVN in Xcode 5.
One way is using an svn client. The one which is obviously available is the command line svn client. So here's how I use it:
Our repository is: https://myserver.me.com/svn/
The repository is added to Xcode using Xcode->Preferences->Accounts.
Create a new project inside Xcode 5: $HOME/IOS/Projects/MyProject
Close the project or maybe even better close Xcode to avoid Xode interfering with svn. Really.
Open a terminal and change directory into the projects folder
cd $HOME/IOS/Projects
Import the project into svn:
svn import -m "New Import" MyProject/ https://myserver.me.com/svn/trunk/MyProject
Checkout the project again to create a working copy
svn co https://myserver/svn/trunk/MyProject MyProject
Re-open the project in Xcode and enjoy svn. The project is now part of the repo.
Select Source Control -> Check Out…
This shows a “Check Out” dialog.
Select SVN from Recents or Repositories tab.
Now, select the directory in which to check out the project.
Click on “Check Out”. This updates the local project to remote SVN.
please refer this.
https://developer.apple.com/library/ios/recipes/xcode_help-accounts_preferences/articles/add_repository.html#//apple_ref/doc/uid/TP40013306-CH4
and on click on setting btn you can import and export also.
In XCode 5, you can add/view repositories at Xcode->Preferences->Accounts. You can also view/enter the repository at "Source Control"->"Check Out..."

Xcode 4: Source Control options grayed out (Git local repository)

When I set up a new project in Xcode 4, and select "Create local git repository for this project," all seems well enough. I'm able to commit files from the Organizer (it would appear.) However, in the Project Manager, the "Source Control" menu options (commit, etc.) are all grayed out, except for "Repositories" which of course just takes me to the organizer.
Furthermore, in the Project Manager window, I don't see any icons by file names indicating if they're changed, committed etc. like I see in the screenshots in the Xcode 4 documentation.
I've tried this with both a project that's connected to Github, and one that's just using a local repository, and I've still yet to see those options not be grayed out. Any suggestions?
I discovered the cause of this problem is that I was saving projects in /Developer.
Turns out, that's a big no-no. Not only does it break git integration in the way described in the original question, as well as breaking other features such as Xcode 4's refactoring functionality, it also runs the risk of deleting all of your work when you install an update. Once I started saving projects outside of /Developer, all the git functions in Xcode 4 started working as expected.
Bottom line: Don't keep projects in /Developer.
This can be a bit confusing. Apples documentation here:
http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html
Has a great way to activate the source control via the command line:
To set up a Git repository from the command line . . .
Use the cd command to switch to your project folder, making it the current working directory.
Enter git init to create an empty repository.
Enter git add . to copy your project files into the repository.
Enter git commit -m "Initial commit." to commit all the files.

How to add a new project to source control in Xcode 4?

How do I add a new project to source control (SVN) using Xcode 4?
Open Organizer. Click on the root of your SVN repository in the tree on the left. Click on Import on the bottom right and choose the directory from finder that you want to add and click Import.
This will add the project to SVN
The XCode 4 documentation recommend using command-line tools or a utility program to set up a Git or Subversion repository.
To set up a Subversion repository using the command line
1/ Open the Terminal utility and use the svnadmin create command to create a Subversion repository.
For example, if you want a repository named Sketch_svn in the existing location /Users/myUserName/Repositories, you would enter the command:
svnadmin create /Users/myUserName/Repositories/Sketch_svn
Tip: The easiest way to get the full path to a folder into Terminal without risking typing errors is to first type the command (cd in this case), enter a space, and then drag the folder from the Finder and drop it at the end of the Terminal command line.
Note that the directory /Users/myUserName/Repositories/ must already exist before you execute this command. You can use the Finder or a mkdir command to create the directory.
2/ In another location—not in the repository you just created—create a folder to hold a temporary copy of the project. In that folder, create three additional folders named branches, tags, and trunk.
3/ Create a new Xcode project in the trunk folder, using Xcode, or put your existing project in the trunk folder, using the command line or the Finder.
4/ Use the svn import function to import your project into the repository you created and place it under Subversion source control.
For example, if your temporary copy is in /Users/myUserName/Projects/Sketch_tmp, you would enter the following command in Terminal:
svn import /Users/myUserName/Projects/Sketch_tmp \
file:///Users/myUserName/Repositories/Sketch_svn -m "Initial import"
Notes
The backslash at the end of the first line indicates that the command is continued on the next line. You can omit the backslash and type the entire command on one line. If you do use the backslash, be sure there are no spaces following it before you press Return.
There are three forward slashes in the string file:///.
If you type the entire command on one line, be sure there is a space before file:///.
You can include any comment you want in the quotation marks, but be sure your comment will be meaningful to anyone using the repository.
5/ In the repositories organizer in Xcode, click the Add (+) button at the bottom of the navigator pane, and choose Checkout Repository to create a working copy.
Use Terminal. At the command line, you can use the svn import command to add the project to your repository.
From the way you worded your question, I'm assuming that your subversion repository already exists. You'll follow the same basic steps outlined in Add Git or Subversion Version Control to an Existing Project in the Xcode 4 Users Guide, except that instead of creating a whole new repository you'll just add a new directory to your existing repository.
It's handy that Xcode has support for version control, but it's not a full-featured GUI version control client. You should still know how to manage your repository using the svn command line program. Alternately, you can get a GUI front end like Versions. Either way, you should have (and have read) the Subversion Book. There's a lot more to using version control than just checking files in and out, and you need to know how it works and how best to use it if it's going to help you.

How would you avoid "Xcode, Subversion Error: 155007 (Path is not a working copy directory)"?

I am not able to see the commit option after I make changes to my working copy, but I ensured that my settings for svn were correct.
What exactly is the problem with this error message?
Xcode is showing:
Your path is not a working copy
What should I do to resolve this?
The blog post "Xcode, Subversion Error: 155007 (Path is not a working copy directory)" and its comment are pretty much the reference on this kind of error.
Simple Workaround:
Delete your local copy (cd myxcodeproject; rm -rf .)
Delete the “build” folder from the server
svn co https://svnserver/path/trunk/project .
Now you should see .svn folders in every directory of your local project (you don’t see them if you use the “Export” function of the SCM panel from Xcode).
At this point, you should be able to edit and commit your changes directly from Xcode.
Now you need to initialize correctly the project.
The following sections illustrate that part:
How to do it right (general principle)
To place the project under Xcode, you need to first import it.
The SCM->commit entire project… gives error 155007 if you don’t first do this:
Under the SCM menu in Xcode select Repositories, then click the IMPORT icon at the top of that dialog that appears.
Select the project from the list and then click the import button.
Of course you need to first configure at least one repository before doing the steps above.
Right Initialization steps (detailed process)
Create the project in XCODE.
Setup subversion in XCODE and select the subversion repository for this project.
Use Xcode SCM > Repository and click on the IMPORT icon. This will move the local copy to the subversion repository.
Now delete your local copy (or move it to another location just in case).
Finally CHECKOUT the project from subversion (this will create the subversion .svn folders, …).
Reselect the subversion repository for this project.
Commit the entire project.

Resources