I recently bought a MacBook Pro that I will use to develop an iPhone app. I want to be able to transfer the Xcode project between my Macbook and my iMac in the same manner that Word documents can be transferred using iCloud. Is there a secure way this can be done?
iCloud or version management?
iCloud might sound good idea for syncing Xcode projects, but it actually leads to problems. You should use git instead. I recommend to use bitbucket (online git repos), which is free. You can host private or public projects on bitbucket. I like bitbucket because of free private repos. GitHub does not provide free private repositories!
Easy to share
When you are done editing your code in one machine, you can commit changes and then push your committed changes into a remote repository. When you are open your project on another computer, you have to fetch it (pull) from the remote repository.
By using git, you can share your code easily with other team members, too.
How to
See more here:
Enable Access to Your Source Code Repositories
Save Project Changes
I'm using dropbox to sync my xcode projects across 2 macs. I had no issues so far but I would recommend not to work on a project simultaneously, so make sure to close it on one machine before you open it on another.
Here is how I use iCloud Drive as a remote git repo:
Create a new Xcode Project (with git versioning turned on) in a local directory, for example ~/Xcode-Projects-Local/GiTest
Clone the new local directory to a remote directory, for example iCloud Documents:
git clone --bare --no-hardlinks ~/Xcode-Projects-Local/GiTest ~/Documents/Xcode-Projects/git/GiTest.git
Add the cloned directory as a remote to the local repo:
cd ~/Xcode-Projects-Local/GiTest
git remote add -f iCloud ~/Documents/Xcode-Projects/git/GiTest.git
On a different Mac, clone the remote repo into a new local directory:
git clone ~/Documents/Xcode-Projects/git/GiTest.git ./GiTest
Enjoy!
For an existing project, just skip step 1. Note the --no-hardlinks option to make sure that hard links won't confuse iCloud drive.
For those wondering 'why not just put the project dir directly on the iCloud drive': Xcode always had and -- as of Xcode 10 -- still has problems with that eventually resulting in a corrupted repo.
If you are planning to work on machines with different screen resolutions, for example Macbook and iMac, you should git-ignore directories named project.xcworkspace/xcuserdata.
Related
i need your friendly help :), i just had to restore my linux distro due to it crashed, before that, i backed up all my projects folders and files. Now i have i completely new Linux installation and i want to connect again to github from my project folder but all project for github is new, i mean when i try to pull something the system says that i have untracked files and it has to be commited, i don't really want to push all my project again so (here the question), is it possible untrack those files for my local repo and continue working as if i've never restored my linux back?
Thanks to all can help me to learn this.
Regards
Anjrot
We are trying to set up Eclipse so that two users can share the same project directory on our server. Is this possible? Every time we try, it creates a new folder and project.
Thanks!
Chris
No, this isn't possible. Eclipse only supports a single user accessing a workspace (not just a project) at a time.
Use a source control system such as Git or SVN to share code. Eclipse supports many such systems and has extensive sharing support in the 'Team' menus.
The best way to do this would be to use source control.
Sharing the actual workspace or the files with different eclipse instance is a recipe for trouble.
An easy way to do this would be to install git on your machine and also on his machine. Eclipse actually already has git in it ready to go so you probably dont need to install anything.
The one with the files locally will create a repo locally on his computer and commit the files to it.
Next you want to init a new empty repository on a shared folder and push your local chances to this as you would to github for example.
Your partner can then git clone from this repository to his machine and work locally.
Each of you will develop on your own copy and commit your changes locally. You will share your changes by pushing your commits in that central repo and pulling from it to get changes from your partner.
You could also just open an account on GitHub, GitLab or BitBucket (there are many others too) and use that instead of a shared folder. big advantage with these services is that they will be available from anywhere.
So, I have a desktop and a laptop. I use both very frequently. I keep my work files on a usb and that is how I get to switch so easily between the two. Now I am beginning a project in which I use android studio and github. I am new to github.
Can I use github in conjunction with this usb drive between two computers or should I commit to using one computer? Will this create problems?
The whole idea behind GitHub is to avoid file transfer manually like that. If you want to do a project on both machines. Then...
Create a GitHub Repository
Pull your project from your repo (Do this on both Systems)
Every time you do something on one machine, before you switch to the next, commit your changes and then push them.
If you are new to Git and dont know how it works, then feel free to check out GitHub Help.
Is Clone the only way for me to get my own repository to a different machine?
I have published my repository from my home PC and am trying to edit it from another.
I'm using Github for Windows but cannot see how to get the published repository to a second machine in order to edit the code and republish the changes so I can later use on the original PC.
The general approach for Distributed Version Control Systems is to:
Clone the repository (from the server)
Update your code (local, in your working directory)
Commit the code (local, in your working directory)
Push the commits (to the server)
Pull the new commits (from the server) to another development PC.
Typical development cycles iterate between steps 2 and 3. And sometimes 4 (to store your changes off-site) and 5 (to grab changed made by others).
As I suppose that 'Github for Windows' uses git(hub), it is also a DVCS and works also with these steps.
The proper way to do this is to clone the repository onto your second machine, straight from the source (Github). Sharing one clone between multiple machines is not recommended except in a few circumstances.
Resolved.
I had to delete the local repository. Github then prompted me with an error and the option to "Clone again", this clone again worked.
Thanks.
We're using Eclipse (with the eGit plugin) and I want to host a repo on a shared network drive that several users have write access to.
Can users all point at the same original repo (on the shared drive) or would it be better for each user to clone the repo to their local drive, work off this local version, and push changes to the networked original as required?
Eclipse seems to allow you to "import" (to your Eclipse workspace) a project from a Git repo, but that imported project doesn't seem to be monitored by Git until you choose to "Share project". At this step the working directory becomes that of the repo's working dir for that project. Presumably all users sharing this project would have the same working dir i.e. that of the repo on the shared drive.
I am not clear on the implications of this, but it doesn't seem like a good idea, on first inspection! How will it handle basic problems like 2 users trying to open the same file for editing simultaneously, for instance?
Thanks.
It's better that each person has their own repo.
Clone you current repository as a bare repo and place it on the network drive.
e.g.
git clone --bare /path/to/current/cool_project cool_project.git
Move the cool_project.git to your network drive, and get everyone to clone from that. Bare repos don't have a working directory, hence the name, so they are safe to push to.
See the chapter 4 of the Git Pro book - Git on a Server, and specifically chapter 4.2 for more details.
From the sound of it you are talking about each user pointing to the git repository over the network and not having individual git repositories on each developer's computers and then pushing to a 'central' repository. If I am correct in reading your question that is not a great way to take advantage of what git has to offer. Git is a distributed version control system so everyone should have their own repository and push the changes to a central repository that you do your CI builds off of.