passforios
passforios copied to clipboard
Allow setting Git repository and push without clone/overwrite
I'm currently dealing with an issue my wife is having with her Pass, where the remote server has died and her phone is the only current set of passwords. Ideally, I'd like to be able to create a new bare repo on a new server and push the whole repo from her phone, rather than having to copy over everything by hand onto the new repo and clone it back onto the phone. Would something like this be possible?
If you set up a new server with the same address and account as your previous server, you can just perform a sync in the app to push all the date from the phone to the new repository. I guess, copying everything manually is not required.
The new server I'm using is using different credentials, different port, etc. It'd be a giant hassle to figure out how to get the previous address working as expected, which is why I'd want the option to change the URL without a fresh clone.
Indeed, there should be a simple way to create a simple repo in an iCloud folder on device for example. Git doesn't require something like GitHub or Gitlab to work, and Pass iOS users all have iCloud at their disposal.
My main .password-store
repo is exactly this -- a symlink (alias) in my home folder to the actual repo folder on iCloud. I just push it to Gitlab as a remote to be able to use elsewhere.
I love the idea of symlinking .password-store
to my iCloud drive. Using a file protocol to access the git repo instead of https or ssh sounds like a good idea if that is workable.
@SimplyDanny I'm once again looking at trying to recover my wife's passwords from her device. Can you confirm that a remote repository being empty won't clear out all of her current local passwords on pull before the push is done? Alternately, has there been any change in accessing the underlying local files?
I just tried with my own repository and it worked. The steps were:
- Do not change any settings in the app.
- Set up a new server with the same hostname or IP address. Admittedly, I did not create a new server. I used the previous one and just moved the repository to another place. I'm not sure whether the underlying Git/SSH implementation would notice that the server changed. If so, all this won't work. If not, it's actually a security issue, I guess.
- For the private SSH key used in the app, add the public counterpart to the
~/.ssh/authorized_keys
file. - At the repository path set in the app, create a new empty bare repository (
git init --bare
). - In the app, create one new commit by changing any password. This step might sound strange, but the app won't push anything if there are no local changes since the last pull.
- Trigger the synchronization action.
- Clone the bare repository to some working folder.
The synchronization step indeed performs a git pull
first. Since the bare repository is empty it won't do anything, though. Otherwise, it would report an error or a conflict, but not override any local changes.