passforios icon indicating copy to clipboard operation
passforios copied to clipboard

Allow setting Git repository and push without clone/overwrite

Open rgallo opened this issue 4 years ago • 6 comments

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?

rgallo avatar Feb 04 '21 02:02 rgallo

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.

SimplyDanny avatar Feb 18 '21 21:02 SimplyDanny

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.

rgallo avatar Feb 18 '21 21:02 rgallo

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.

StarrWulfe avatar Feb 24 '21 02:02 StarrWulfe

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.

robertwahler avatar Mar 04 '21 16:03 robertwahler

@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?

rgallo avatar Mar 02 '22 18:03 rgallo

I just tried with my own repository and it worked. The steps were:

  1. Do not change any settings in the app.
  2. 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.
  3. For the private SSH key used in the app, add the public counterpart to the ~/.ssh/authorized_keys file.
  4. At the repository path set in the app, create a new empty bare repository (git init --bare).
  5. 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.
  6. Trigger the synchronization action.
  7. 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.

SimplyDanny avatar Mar 11 '22 23:03 SimplyDanny