Hi @azdev and welcome to the forums!
Just to add to what @rawtaz said, you can have the pretty much anywhere you have write-access to.
When you want to use a different directory, change the
--repo . argument to
--repo /path/to/repository (Substituting
/path/to/repository with the location you want the repository at. ) The
--repo argument tells restic where the repository is located. You’ll need to run
restic init --repo .... again there though.
As @rawtaz mentioned, generally you shouldn’t have the repository in the same location you’re backing up. This is generally not beneficial, but I’d imagine could also be harmful if restic tries to backup it’s own repository into itself. The reason restic did it in your home directory was because your terminal session working directory was your home directory and you ran
restic --repo . init. You may know already, but in Linux/Unix,
. is shorthand for the current working directory. Generally this isn’t a great practice for something like restic either, as full paths are your best bet for making things always work. If you were in another directory, restic would try to backup to the directory you were in, where there’s no repository. The same thing goes for the directory to backup in
restic --repo ... backup /backup/here. Something better would likely be:
restic backup --repo /restic/repository/path backup ~/ (replacing the repo path again.)
I apologize if this information is already familiar to you, but I just wanted to clarify just in case.