Files
heartwood/radicle-cli/examples/rad-init-existing.md
T
cloudhead ee1c867800 cli: Add way to init from existing repositories
This adds an option to `rad init` to initialize a working copy with
an existing radicle repository in storage:

    rad init --existing <rid>

This sets up the remote(s) and configures the repo for you.
2024-07-29 11:49:19 +02:00

41 lines
1.1 KiB
Markdown

Let's clone a regular repository via plain Git:
```
$ git clone $URL heartwood
$ cd heartwood
$ git rev-parse HEAD
f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354
```
We can see it's not a Radicle working copy:
``` (fail)
$ rad .
✗ Error: Current directory is not a Radicle repository
```
Let's pick an existing repository:
```
$ rad inspect rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
```
And initialize this working copy as that existing repository:
```
$ rad init --existing rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
✓ Initialized existing repository rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji in [..]/heartwood/..
```
We can confirm that the working copy is initialized:
```
$ rad .
rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
$ git remote show rad
* remote rad
Fetch URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji
Push URL: rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
HEAD branch: (unknown)
Remote branch:
master new (next fetch will store in remotes/rad)
Local ref configured for 'git push':
master pushes to master (up to date)
```