Push Workspace with multiple projects on Bitbucket repository - ios

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

Related

How to avoid Ds_Store and pods while pulling in Xcode source control?

My team member pushed pods and ds_store. We use .gitignore file and also added everything to ignore. But still getting conflicts on every pod files and all when I pull it in my mac.
How can I remove them all and make it future friendly without any errors anymore.
This is how my conflict looks:
This is happening because the files are already tracked by git.
So you need to remove them from the repo.
To remove a single file...
git rm README.md
To remove a folder...
git rm -rf Pods
Once you have done this you will need to commit the change to the repo and then those files/folders should no longer be tracked as long as you have them listed in the .gitignore file.
git add .
git commit -am 'refactor: remove un needed files'
git push
To recursively remove all DS_Store folders from the repo do
find . -name '.DS_Store' -type f -delete
First remove,
rm .DS_Store
then pull,
git pull origin master

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/

How to use Git source control in Xcode 7.2?

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"

git checkout master command gives error that a file would be overwritten

I just made tried to do git checkout master and I got this error:
macoss-MacBook-Pro-10:Marketing owner12$ git checkout master
error: The following untracked working tree files would be overwritten by checkout:
Marketing.xcodeproj/project.xcworkspace/xcuserdata/owner12.xcuserdatad/UserInterfaceState.xcuserstate
Please move or remove them before you can switch branches.
Aborting
but I am not sure how to handle this situation. I don't mind having this file overwritten by what is in the repo. What is the correct way for me to proceed here?
Thanks!
You have files that are not being tracked. Either
rm untracked.file1 untracked.file2
or
git add . && git commit -m "adding new previously untracked files that serve a purpose"
if you're having permission issues:
git add --ignore-errors .
Either delete the file if you don't care about it or stash it if you think you will need it in the future. Or simply rename.
Commit the files you want to keep and then do a git clean to remove the extra files you don't want to keep. This article on the git ready website describes it very well.
If you just want to get rid of one or two files in your working directory then you can do a dry run first and see which files would be cleaned up using:
git clean -n
And then when you are sure do this:
git clean -f
git clean has a -d switch if you want to clean up directories as well. And you can use that together with the other switches, so this is what I would normally use (and then after the dry run change -n to -f):
git clean -n -d
Then after your git clean, use:
git status
to make sure that you have no untracked files or uncommitted changes. And lastly switch to master with:
git checkout master

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