Sync with Git
If you can’t use iCloud on your Mac due to security restrictions for example, you can still sync your notes using git.
Before we start
You need the following accounts and apps:
- A GitHub (preferred) or BitBucket account.
- Download and purchase the app “Working Copy” on iOS. You need the premium version so you can push changes to the server.
- Download a git client on Mac, such as GitHub’s Desktop client (free) or Sourcetree for BitBucket (free). You can also use the terminal, but a client app will make things easier to manage.
Setup your repository
- On Mac and iOS, run NotePlan at least once, so the notes folder gets created.
- Set the sync on Mac and iOS inside NotePlan to “No Sync” in the preferences.
- Open Finder at NotePlan’s sync folder and delete “co.noteplan.NotePlan3”, backing up any files, if you already have some. GitHub can’t create a new repository in an existing folder.
- Open GitHub Desktop or any other git app, create a new repository pointing to the “.../Application Support” directory where we deleted NotePlan’s sync folder and name the folder “co.noteplan.NotePlan3”.
Make sure to change the user name ("eduardmetzger") in your local path to your Mac's username, if you copy it from above.
- Copy any files back which you have backed up before.
- Now we need to ignore some folders from syncing, otherwise, they will create conflicts continuously. Ignore the folder “Caches”, “com.microsoft.appcenter”, and files ending with “.log”. You can do this in the GitHub Desktop app under "Repository" > "Repository Settings" in the menubar:
Paste the following in there:
Caches* *.log com.microsoft.appcenter*
- Make your first push on Mac! First, you need to commit by entering a summary (such as "update") bottom left and clicking on "Commit", then press the push button top right in GitHub Desktop.
- On iOS, close NotePlan and open NotePlan’s folder in the Files app in “On my iPhone/iPad” and delete any files in there, so they don’t cause issues.
- Setup Working Copy the same on iOS. Tap on the plus icon at the top left and then on “Setup synced directory” and select NotePlan’s folder in “On my iPad/iPhone”.
- Add the previous repository we have created on your Mac to this folder and pull changes. First go to your GitHub account in Safari and open the newly created repo, then click on the green "Code" button to copy the "SSH" link:
Then on iOS, in the Working Copy app, tap on the synced NotePlan folder you have added before, now called "Documents", tap at the top on "Repository", then tap on "Add Remote" at the bottom:
Into the URL field, paste or type the SSH URL we have copied before from the GitHub repository website:
If you are already authenticated with GitHub, you can tap on "Test". If you are not authenticated, you can tap at the top right on "Save", go back to the first screen in Working Copy and open the preferences by tapping on the preferences icon top left. Inside the preferences, select "SSH Keys":
Tap on the key which should be already available:
Then tap on "Connect with GitHub" and enter your GitHub username, password, etc:
- Now you are ready. You can make changes either on Mac and iOS and then you have to manually commit and push the changes. On the other device, you will need to pull changes every time. If you don’t do this, you will run into conflicts, which you can resolve with the git apps easily.
Your first sync
- To make your first sync, change a file on your Mac by entering something for example in today's note.
- Then open GitHub Desktop and you should see some files on the left under "changes".
As before, enter something into the summary field below and hit "Commit", then "Push origin" at the top right.
- Now open Working Copy on iOS, select your repository called "Documents" and hit the Working Copy button at the bottom right. From here you can also commit, push and pull. Since we want to pull the changes we did on Mac, we need to select "Pull" and this should download the changes.
- If you make a change in NotePlan on iOS, you can go back to Working Copy, tap on the floating button bottom right again and this time commit your changes by selecting all files which are listed, hitting "Commit" (type a summary if needed) and then hit "Push".
- On Mac, you can open GitHub Desktop and pull the changes.
You might run into a conflict if you have changed a note on two different devices without pushing/pulling first. In this case Working Copy or GitHub Desktop will notify you of the conflict and you need to resolve it by selecting the version you want to keep or trying to merge it. Then you commit this selection and pull again.