Clone, fetch, pull, and push to remote repositories
wit provides full support for remote Git operations, allowing you to collaborate with others using any Git hosting service including GitHub, GitLab, Bitbucket, or self-hosted servers.
# Clone into a new directorywit clone https://github.com/user/repo.git# Clone into a specific directorywit clone https://github.com/user/repo.git my-project# Clone into current directorywit clone https://github.com/user/repo.git .
# Clone a specific branchwit clone -b develop https://github.com/user/repo.git# Shallow clone (faster, less history)wit clone --depth 1 https://github.com/user/repo.git# Bare clone (no working directory)wit clone --bare https://github.com/user/repo.git# Clone without checking outwit clone -n https://github.com/user/repo.git
Option
Description
--depth <n>
Create a shallow clone with only n commits of history
# List all remoteswit remote# List remotes with URLswit remote -v# Add a new remotewit remote add origin https://github.com/user/repo.gitwit remote add upstream https://github.com/original/repo.git# Remove a remotewit remote remove upstream# Rename a remotewit remote rename origin github# Show remote detailswit remote show origin# Update remote URLwit remote set-url origin https://github.com/user/new-repo.git# Get remote URLwit remote get-url origin
Download objects and refs from a remote without merging:
Copy
# Fetch from origin (default remote)wit fetch# Fetch from a specific remotewit fetch upstream# Fetch all remoteswit fetch --all# Fetch and prune deleted remote brancheswit fetch --prune# Fetch with tagswit fetch --tags
# Pull from tracking branchwit pull# Pull from specific remote/branchwit pull origin main# Pull with rebase instead of mergewit pull --rebase# Pull and auto-stash local changeswit pull --autostash# Only fast-forward (fail if not possible)wit pull --ff-only
Force Push Warning: Using --force can overwrite remote history and cause problems for collaborators. Prefer --force-with-lease which checks that the remote hasn’t changed before pushing.
Push to multiple remotes simultaneously. This is useful when you want to keep both a wit server and GitHub (or another Git host) in sync:
Copy
# Push to origin and also to github remotewit push --also github# Push to a specific remote and also anotherwit push origin main --also github# Push to ALL configured remoteswit push --all-remotes
Use Case: If you’re using wit as your primary version control but need to sync with GitHub for CI/CD or deployment providers (Vercel, Netlify, etc.), dual-push keeps both remotes in sync with a single command.
Example workflow:
Copy
# Set up remoteswit remote add origin git@wit-server:user/repo.gitwit remote add github git@github.com:user/repo.git# Push to both with one commandwit push origin main --also github# Or push to all remoteswit push --all-remotes
If your push is rejected, it usually means the remote has changes you don’t have:
Copy
# Push rejected - remote has new commitswit push# ! [rejected] main -> main (non-fast-forward)# error: failed to push some refs# Solution: Pull first, then pushwit pullwit push# Or if you're sure, force pushwit push --force-with-lease
Set up tracking between local and remote branches:
Copy
# Push and set upstreamwit push -u origin feature# After this, you can just use:wit pushwit pull# See tracking configurationwit branch -vv# Set up tracking manuallywit branch --set-upstream-to=origin/main main