How to use Git source control in Xcode 7.2? - ios

I am using Xcode7.2 and i created new project with “Source Control- Create Git repository on” . However this project is created but automatically show popup message like this “Couldn’t communicate with a helper application”.
After this project is created I see the local branch is missing and I can not commit files ("Commit files" does nothing).I also noted following point like When Xcode is started the following error is presented: "Couldn’t communicate with a helper application". How to solve this issue ? Please help me.

Try to create git repository from terminal if you haven`t created it when creating project.
Remove git repository if you have created. (Open Terminal go to git repository and remove it by rm -rf .git )).
Go to your XCode project (where .xcodeproj file is) and create git repository by typing this command git init
Add files you to your git repository. (git add --all)
(If you want to ignore some files you can create .gitignore file in this folder and list files which are you want to ignore)
Commit it. git commit -m "First C"

Related

What files should Xcode projects track when git commits

I took over an iOS project completed by objective-c. The project does not use git, and I want to use git to manage it locally.
I performed the following steps, and then when I submitted, I didn't know which files to add to the tracking file. (I created git to ignore files)
Steps i did
I opened the terminal and entered the following command:
cd /Users/xxx/Desktop/xxx/Myproject
git init
touch .gitignore
open .gitignore //I manually added the ignore rule in .gitignore and saved
git status //我没有修改任何代码,而且没有执行 git add ,因为我不知道该添加哪些文件到追踪文件
This is ignore file
Should I execute git add .? Or should I choose some additions?
I hope you can tell me the method and reason, I do n’t understand what I found on Google.

How to create our own Cocoapods if app have already some other pods dependency like Almofire, SwiftJSON, etc

I have developed my own application and this app have already some pods dependency like Almofire, SwiftJSON, MBProgressHUD and many more. I want to create my own Cocoapods in which these dependency can be linked
Please follow these steps to create your won Cococapods -
Create a public repository on your git account
Copy Repository Url. Open terminal and run following command.
git clone <-Repository Url->.git
Now Copy all the xcode project file and folder inside the cloned
repo. and run the below command
git add *
git commit -m "Initial Setup"
git push origin master
Create a new release to go to your git repository or run following
commands
git tag 1.0.0
git push --tags
Generate create Podspec file
Run the below command to generate the podspec file.
touch reponame.podscpec
Open the podspec file on any editor and paste these text as it is.
Format like below attached screenshot.
Save the file and Now run the below command on terminal.
pod lib lint
If validation passed. then run the below commands
pod trunk register <-abx#xyz.com-> 'user name'
You will get an email for verification. Just verify the email and now run the below command.
pod trunk push PodName.podspec
If all goes well, you will get this on terminal
Congratulations. Now you can use this pod whenever you want.
You can follow this link as well. I have created my own steps with reference for this link to ease the ways.
https://www.appcoda.com/cocoapods-making-guide/

Push Workspace with multiple projects on Bitbucket repository

I have Xcode workspace which has multiple projects - the main project and a pod project. How do I push the code (the first time) on Bitbucket so that everything is set on repository ? Attached is the project structure just for clarification
This is the folder structure I have
All you got to do is go to the Project folder in Terminal and follow the below commands in the same order. I am assuming both your main project and pod project are inside the same folder
So in terminal go inside your first AppIT folder. If you run command ls -l in terminal on that folder you will see a list of all folders and files inside it like AppIt, .xcodeProj file, Pod folder, Podfile etc. Just run the below commands on that location where you see this list.
git init
git add -A .
git commit -m "first commit"
git remote add origin https://github.com/.... .git // your complete URL
git push -u origin master

Force git to ignore a directory and all present and future files within

So, I'm a newbie at git, but I'm using it because I have my rails app deployed through heroku. My app generates a bookmarklet (which is just a js file) for each user upon sign-up. Unfortunately, when I deploy, all of the bookmarklets for the users on the live site get overwritten with the bookmarklets for the users on my dev environment. I've read some other questions about this kind of thing, and I know I'll have to add the bookmarklet folder to the .gitignore file, and something about rm --cache (but I'm not sure exactly what I'll have to do). I tried doing these things, but I'm wondering if the problem is that git is ignoring all of the files that are there now, but isn't ignoring the ones that are generated after doing the whole gitignore process. Either that or I'm just doing it wrong (this is very, very likely).
Any help is welcome. And sorry that this covers the same ground as a lot of other similar questions. I did as much research as I could.
Thanks.
Here some simple steps:
Create a file .gitignore in the root of your repository, with the following simple content:
/path/to_your/folder
Add the file to your repository:
git add .gitignore
Remove the folder from your repository (this won’t physically delete the folder):
git rm --cached /path/to_your/folder
Commit
git commit
After that, the folder should be removed from your repository and subsequent changes in it will be ignored by git.
Sounds like Heroku is cleaning out every file not checked in to your Git repository when you deploy. Modify your app to save the bookmarklets to a directory outside of your Git repository.
#poke's answer is mostly correct, but the leading slash in the path name is problematic so I'm posting revised instructions.
The following steps assume the subdirectory inside your git repository is named foo.
Make sure you're at the top level of your Git working directory:
cd "$(git rev-parse --show-toplevel)"
Add foo to your top-level .gitignore file:
echo /foo/ >>.gitignore
The leading slash says to ignore foo in the top level but not */foo or */*/foo, etc. The trailing slash says to ignore foo if it is a directory, but not if it is a file or symbolic link.
Stage the newly modified .gitignore:
git add .gitignore
Commit:
git commit -m "Add foo to .gitignore"
Stop tracking the contents of the foo directory in the Git repository:
git rm -r --cached foo
The --cached option tells Git to not delete the foo folder from your working directory.
Commit:
git commit -m "Remove the foo directory"
Add the following to your .gitignore:
path/to/ignore/**/*
If there are already tracked files on that path, they won't be ignored.
You'll have to run
git rm -r --cached path/to/ignore/

Error : Fatal: Not a git repository (or any of the parent directories): .git

When I try to put images into the Resources folder of my project, I got this message :
fatal: Not a git repository (or any of the parent directories): .git
How can I fix that?
Had the same problem. I copied a project then tried to delete files.
If you want to be able to edit the project, type git init folder in the terminal. This will re-initialize the git in your folder.
Go to Organizer->Repositories and remove the Corresponding repository.
Faced the same problem in Xcode 4.6.1 after moving my folder and xcodeproj file. Here's what works for me:
Delete corresponding repository in Organizer
Close Xcode
Delete the original .git directory
git init in the new directory where you placed the folder and xcodeproj file, and do an initial commit
Start Xcode
In order to do anything in Git, you have to have a Git repository. This is where Git stores the data for the snapshots you are saving.
so just go into your project directory let say you have a project name test_project just go into that directory and type the command
git init
and this will work.
Perform these two steps in Xcode 11, to get rid of this error:
In the menu, select Source Control > Create Git Repositories.
Click on the Create button.

Resources