Remotes

What is a remote?

A remote is a Dolt database in another location, usually on a different, network accessible host. A Dolt remote is the coordination mechanism between many local copies of Dolt. A Dolt database can have multiple remotes.
DoltHub is a hosted Dolt remote with addition discovery and management user interface. Dolt also supports filesystem, HTTPS, AWS, and GCS remotes.
You configure a Dolt database as a remote. Once configured, you can perform Dolt's distributed operations using that remote: clone, fetch, push, and pull.
Clone creates a copy of remote database in your current directory. In the case of clone, the remote you cloned from is automatically configured as the origin remote.
Fetch gathers all the changes made to the remote since you last fetched.
Push performs a merge of your current branch and the remote branch you are pushing to. It sends all the associated changed data and schema to the remote and updates the commit log to reflect the push.
Pull performs a fetch then a merge of the remote branch to your local branch. Essentially pull merges the changes on the remote branch into your local branch.

How to use remotes

A remote is the basis for all the distributed collaboration features of Dolt.
If you would like to make sure your local database can survive a destructive local operation, you create a remote on another machine and push your local Dolt database to it.
If you would like a Dolt database to be used by more than one person, you create and configure a remote and then push your local Dolt database to that remote. That person then can clone or pull the remote.

Difference between Git remotes and Dolt remotes

Dolt and Git remotes are conceptually the same. Practically, in Git you can set your own local Git directory up as a remote. In Dolt, this is not supported. You must configure a dedicated location for your Dolt remote.

Example

1
dolt $ dolt clone timsehn/docs
2
cloning https://doltremoteapi.dolthub.com/timsehn/docs
3
29 of 29 chunks complete. 0 chunks being downloaded currently.
4
dolt $ cd docs/
5
docs $ dolt ls
6
Tables in working set:
7
docs
8
9
docs $ dolt sql -q "select * from docs"
10
+----+----+
11
| pk | c1 |
12
+----+----+
13
+----+----+
14
docs $ dolt sql -q "insert into docs values (0,0),(1,1),(2,2)"
15
Query OK, 3 rows affected
16
docs $ dolt sql -q "select * from docs"
17
+----+----+
18
| pk | c1 |
19
+----+----+
20
| 0 | 0 |
21
| 1 | 1 |
22
| 2 | 2 |
23
+----+----+
24
docs $ dolt add docs
25
docs $ dolt commit -m "Committing inserts so I can push it to my remote"
26
commit uhumidn2e7ucan59jk9vuabm7r5osggs
27
Author: Tim Sehn <[email protected]>
28
Date: Mon Dec 06 17:14:46 -0800 2021
29
30
Committing inserts so I can push it to my remote
31
32
docs $ dolt remote
33
origin
34
docs $ dolt remote -v
35
origin https://doltremoteapi.dolthub.com/timsehn/docs
36
docs $ dolt push origin main
37
\ Tree Level: 1, Percent Buffered: 0.00% Files Written: 0, Files Uploaded: 1
Copied!
Last modified 1mo ago