LogoLogo
BlogDiscordGitHubDoltgres
  • Introduction
    • What is Doltgres?
    • Installation
    • Getting Started
  • Concepts
    • Git
      • Commits
      • Log
      • Diff
      • Branch
      • Merge
      • Conflicts
      • Remotes
      • Working Set
    • SQL
      • Databases
      • Schema
      • Tables
      • Primary Keys
      • Types
      • Indexes
      • Views
      • Constraints
      • Triggers
      • Functions
      • Procedures
      • Users/Grants
      • Transactions
      • System Variables
    • RDBMS
      • Server
      • Backups
      • Replication
  • Guides
    • Cheat Sheet
    • Replication from Postgres
  • Reference
    • Running the Server
      • Configuration
      • Access Management
      • Branch Permissions
      • Backups
      • Garbage Collection
      • Metrics
      • Replication
      • Troubleshooting
    • Version Control Features
      • Using Branches
      • Merges
      • Querying History
      • Using Remotes
      • Functions
      • System Tables
      • System Variables
    • SQL Language Support
      • Supported Functions and Operators
      • Supported Types
      • Supported SQL Commands
      • System Catalog Schema
    • Supported Clients
      • Programmatic
    • Benchmarks
      • Correctness
      • Latency
Powered by GitBook
On this page
  • What is a remote?
  • DoltHub remotes
  • How to use remotes
  • Difference between Git remotes and Doltgres remotes
  • Example
  1. Concepts
  2. Git

Remotes

PreviousConflictsNextWorking Set

Last updated 7 months ago

What is a remote?

A remote is a Doltgres database in another location, usually on a different, network accessible host. A Doltgres remote is the coordination mechanism between many local copies of Doltgres. A Doltgres database can have multiple remotes.

You configure a storage location as a remote. Once configured, you can perform Doltgres'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.

DoltHub remotes

remotes aren't currently supported for Doltgres databases. Only self-hosted remotes using local file stores or cloud storage are currently supported.

How to use remotes

A remote is the basis for all the distributed collaboration features of Doltgres.

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 Doltgres database to it.

If you would like a Doltgres database to be used by more than one person, you create and configure a remote and then push your local Doltgres database to that remote. That person then can clone or pull the remote.

Difference between Git remotes and Doltgres remotes

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

Example

select dolt_clone('file:///var/share/doltgres-remotes/docs');
\c docs;
select * from docs;
+----+----+
| pk | c1 |
+----+----+
+----+----+
insert into docs values (0,0),(1,1),(2,2);
select * from docs;
+----+----+
| pk | c1 |
+----+----+
| 0  | 0  |
| 1  | 1  |
| 2  | 2  |
+----+----+
select dolt_commit('-m', 'Committing inserts so I can push it to my remote');
select dolt_push('origin', 'main');
DoltHub