Workflow for getting Github repository updates - iphone

There are a lot of great open-source projects on github. Most of them come with great sample apps.
Now I go through the following steps to get a repository:
Visit a github repository, e.g. https://github.com/omz/AppSales-Mobile
Click Clone in Mac to clone the project
Open GitHub app in Macbook
Right-click AppSales and select Show in Finder
Open the xcodeproj in Xcode
Modify Bundle identifier in ...-Info.plist file
Modify Code Signing Identity in the target
Compile and run
Whenever there is any update in the repository, I open the Github app and discard changes made in step 6 to 7 above, and sync. Then go though step 6 to 8.
By using the Github app, how can I keep the changes made in step 6 to 7 and also get new updates also?

Use a git client and most of the repetitive tasks you are doing now will just ... go away. Tower is a good choice, but you can always use the command line as well:
git clone https://github.com/omz/AppSales-Mobile.git
cd AppSales-Mobile/
open -a XCode AppSales.xcodeproj/
Run the project, change files, do whatever. Then when ready to get updates from upstream server just do:
git pull (or git fetch, then git merge).
Alternatively you could add the files you are changing to your .gitignore file, so that they aren't tracked by Git.

Related

Unable to create remote repository when using .xcworkspace Xcode 9 + GitHub

I am using Xcode 9 (Beta) which has GitHub integrated into it.
Please note I have pod files (223 MB size !!) in the project, and I've also set up GitHub account in Xcode preferences.
When I don't have any pods installed, I am able to create remote repository on GitHub by opening the .xcodeproj file and following the below steps, however it doesn't work when I have pods installed (see below steps).
How could I get around this issue ?
Below are the steps I am following to create a remote repository on GitHub using Xcode 9 (Beta).
1. Open .xcworkspace file
2. Create Git Repository
Xcode > Source Control > Create Git Repositories
3. Creating remote repository on GitHub
Result
Private commits are enabled for paid users only. Try committing with public visibility and it should probably work.

How do I configure Git in Xcode to work with BitBucket

I have a project which I have been on for ages which is not connected to any source code repository.
I want to start using BitBucket now, however I am not sure how to go about it. I have created a project in BitBucket.
Should I now clone and check out in Xcode or should I add a repository in xcode. Anyone have any idea?
I have tried cloning using the URL from bitbucket but it just comes back with an error in Xcode
I've met the same problem and here's how I solved it:
(Assume your project is not already under local source control) Create a new project under LOCAL source control (Please note that adding remote source control at this stage may not be successful)
Make this new project a clone of your old project - drag files, add frameworks, etc.
In menu "Source Control" -> -> "Configure "
In the new window, click on "Remotes" -> "+" -> "Add Remote"
Name: anything (you can use "BitBucket")
Address: https://accountname#bitbucket.org/accountname/reponame.git
"Source Control" -> "Commit"
Select "push to remote" at the left bottom corner
Click "Commit"
Check on BitBucket website to see if it's actually pushed to it
As of 2017, xCode now automatically creates repositories for new projects. To push to a new BitBucket repo, go to 'Source Control' > 'Commit...' in xCode and make your first local commit.
Next open a terminal and navigate to to the top-level directory of your project. If you ls -a in here you should see the .git/ directory has been created. In the same directory, add your remote repo with the following (replace with your username/team name and repo name):
git remote add origin https://USERNAME#bitbucket.org/USERNAME/REPO_NAME.git
Go back into xCode, go to 'Source Control' > 'Push...'. You'll be prompted to enter your BitBucket password. Press OK and you're done! Source control commands will now be working within xCode.
I did that through command line and it is fairly straightforward.
create a new repo on bitbucket
assuming your xcode project is not under local git version control yet
go to command line, cd to your xcode project directory, and the follow the bitbucket doc: https://confluence.atlassian.com/display/BITBUCKET/Import+code+from+an+existing+project
git init
git remote add origin git#bitbucket.org:<user_id>/<repo>.git
git add .
git commit -am 'init commit'
git push -u origin master
go back to xcode and you should be able to interact with bitbucket through xcode from this point on
Using the following URL structure
https://accountname#bitbucket.org/accountname/reponame.git
(Taken from here) did the job for me
It is easier to:
create your local Git repo through XCode and add your code there
in command line, add the remote 'origin' toward your BitBucket repo, along with your ssh credentials (in ~/.ssh/config): see
"Bitbucket + XCode 4.2 + Git".
"Using the SSH protocol with bitbucket"
do at least one "git push myrepo origin master" to initiate the first push
This link helped me, I will also copy and paste the instructions in case the link goes away.
http://sketchytech.blogspot.com/2016/02/send-xcode-project-to-bitbucket.html
Sending a non-git Xcode Project to BitBucket from GitHub is the most popular place to host your repos but if you are looking for a free service for teams that are 5 members or less then take a look at BitBucket. Here are instructions for moving a local Xcode project onto BitBucket. (Note: if you opted for a local Git when you created your project you should be able to skip steps 3 and 4.)
-Sign-up for BitBucket and create a repo
-In Xcode go to Source Control menu
-Select "Create a working copy ...."
-Select project and press Create in dialog window
-Return to Source Control menu and select -> Configure ...
-Click "Remotes" tab
-Press add "+"
-Copy and paste the https address you see at the top right of your repo page into the remote location in Xcode
-Go to Source Control menu and select Push... to upload the project
Pushing code updates to BitBucket
Now you have it set up whenever you want to push code to the project:
-Go to Source Control menu and select Commit
-Write a commit note and uncheck anything not to be included in the commit
-Return to Source Control menu and select push
-Select the correct branch and Push
Pulling code down from BitBucket repo
To get code provided by others down from BitBucket:
-Go to Source Control menu and select Pull.
I use SourceTree and Xcode 6.1 and in my case I first create a repository on bitbucket, then I clone my repository on an empty folder (using SourceTree or via command line) then when you create the new project on XCode in that folder, you can commit push and pull normally from XCode
I found this youtube video and it helped me a lot, used this Atlasssian help for ssh authentication, and encountered an Xcode problem for which the solution can be found in this page.
Most simplest way is go to
Xcode > preference > #accounts > click '+' button on corner left
... then this popup will appear ...
just click Bitbucket Cloud ...
Enter ID with password...
And that's it...

Using Source Control with git and new projects

I'm new to SCM and I've managed to create and use a repository for an existing project. By following a variety of posts, I've done the following:
1) Created an account on Assembla
2) Used bash/git in my existing project directory to add, commit, and push the project
3) Used Source Control in XCode to pull, modify, commit, and push changes
Now I want to start a new projection Xcode, and it seems I have to go through the same steps, using a mixture of Xcode 4.2 and bash commands to get the new project into Assembla.
For example, I created a new space on Assembla "newjunk", started a new project in Xcode "newjunk" and did NOT check "create local git repository". I did not run any bash/git commands. In Xcode I cannot "push" because I did not "commit", and I can't "commit" because "no valid working copies were found".
Is this the only way to get a new project into a remote repository?
Or can it all be done from within Xcode, and if so how?
EDIT: Note - I've tried these steps (modified for Assembla and Xcode 4.2) http://www.mindthe.net/devices/2011/04/28/12-steps-to-using-github-with-xcode-4/ which is how I got the "no valid..." message
This helped me a lot
http://helpdesk.assembla.com/customer/portal/articles/678953-setting-up-git-on-windows
I preffered using TortoiseGit

Why am I unable to retrieve commited new folder from svn with Xcode 4?

I just started to use SVN with Xcode and stumbled upon several problems. I have started to work with SVN repository that was deployed on a remote server. The project had a standard directory structure (trunk, branches, tags). I have checked out the project with Xcode, did some work, performed commit (from Xcode). The teammate checked out that version. Then using Xcode, I have added new images folder and images to svn repository, and successfully performed commit. I ensure you that the image folder and the images were successfully uploaded to SVN server, because I saw that folder and images in trunk both from Xcode organizer and from browser, when was viewing the project remote files.
Now, my teammate performed update from Xcode (via file -> source -> update) but the image folder and images have not been retrieved. Xcode 4 just showed a message that a "project is up to date". He also went to organizer, then selected the trunk of repository and pressed update button, but the same message about project being up to date was shown. After more several tries, he deleted his local project files and performed checkout, but now the images were successfully retrieved. What might be a cause of such problem?
I know that for all required tasks I might use svn terminal commands, just curious is it sufficient to use Xcode 4 without command line.
We've had several issues with Xcode's SVN and have had to resort to the command line a few times to resolve them. Sometimes restarting Xcode has been enough, but if not here's a few simple svn commands that might help shed light on the issue, execute these from your project's root folder:
To check what state your SVN is in:
svn status
To update to most recent:
svn update
To commit:
svn commit -m "A commit message"

How can I add an existing project as a working copy in XCode 4?

Today I switched from XCode 3 to XCode 4 and now I have a lot of problems with my projects, which were under version control in XCode 3. If you install XCode 4, it will remember all your repositories. The problem is, that the projects don't know, that they belong to a specific repository. The instructions of Apple are easy, but do not work:
If you have a working copy of a project that was checked out of Subversion or cloned from Git using the command line or another tool, you can add it to your Xcode SCM repository support. To do so, click the Add button (+) at the bottom of the navigation pane in the repository organizer and choose Add Working Copy.
If I choose the project directory, I get this:
The working copy could not be added because its repository could not be located.
Does anybody know what the problem is?
To avoid confusion, I want to make a few things clear: my projects were under version control in XCode 3 and it worked. I am also aware of the fact, that I could delete all my projects and check them out (I don't want to do that). I already tried to checkout a project, and then this project is automatically added as a working copy. However if I remove the reference and try to add the same (!!) project as a working copy again, it does not work either.
The key for me was quitting Xcode then following Apple's instructions exactly. In Terminal:
$ cd project_folder # project containing the .xcodeproj file
$ git init
$ git add . # note the dot after "add"
$ git commit -m 'Initial version text'
Then get back into Xcode, open the Organizer, et voilà — instant repository.
I was able to resolve this by quitting Xcode and then opening the repository organizer before opening my workspace. Then it worked and I could open my workspace with SVN integration.
In Terminal, you may get the error:
-bash: git: command not found
This is because the git tool (and svn too) are contained inside the Xcode.app bundle in XCode 4.5 or later. In order to run the contained tools you need to use the xcrun command. For example, to run the git commands mentioned in the posts above:
$ xcrun git init
$ xcrun git add .
$ xcrun git commit -m 'Initial
version text'
For more info, see this link:
http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/
What I had to do was, as Udi pointed out, close Xcode and open the organizer before opening any projects. But then I had to add the repository and it's credentials first (SVN, in this case) before following the Apple directions you (mowidev) posted. After doing this, the working copy then appeared inside the listing for the SVN repository I'd added.
That ultimately linked in the two (Xcode project source control settings with the existing working copy it was using). Anything out of order ended up with Xcode thinking it was a Git repo (that also didn't exist).