Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

DVC Commands.md 2.3 KB

You have to be logged in to leave a comment. Sign In

DVC Tracking

This file contains the commands for the DVC Tracking part in the DAGsHub Walkthrough session.

We will start by cloning the repository to the local machine

git clone https://dagshub.com/<DAGsHub-user-name>/<repo-name>.git

Configure DVC locally

We recommend you create and activate a virtual environment before moving forward

  • Make sure you're in the project directory when following this.

  • If you're using Python 2, replace venv with virtualenv in the below commands.

  • The name of the virtual environment is for you to choose. The convention is 'env' or 'venv'.

  • We will add the virtual environment name to the .gitignore file, so Git will not track it.

    • Mac-os, Linux
      python3 -m venv <virtual-environment-name>
      echo <virtual-environment-name> >> .gitignore
      source <virtual-environment-name>/bin/activate
      
    • Windows
      py -m venv <virtual-environment-name>
      echo venv >> .gitignore
      <virtual-environment-name>/Scripts/activate.bat
      

Install DVC on the virtual environment and initialize it.

pip install dvc
dvc init

Track the DVC config files using Git

git add .dvc .dvcignore
git commit -m "init dvc"

When you create a DAGsHub project, it is automatically configured with its own DAGsHub Storage remote. To configure it locally, all you need to do is copy and paste four commands from your DAGsHub repository to your CLI.

  • Copy the commands form the DAGsHub repository, under the remote, to your CLI

    dvc remote add origin https://dagshub.com/<DAGsHub-user-name>/<repo-name>.dvc
    dvc remote modify origin --local auth basic
    dvc remote modify origin --local user <DAGsHub-user-name>
    dvc remote modify origin --local password your_token
    

Track the changes to the DVC config files using Git

git add .dvc/config
git commit -m "set dvc remote"

Track files using DVC

Create a new file

echo >> dvc_demo.txt

Add the new file to DVC tracking.

dvc add dvc_demo.txt

Track the changes that were made to Git tracked files:

git add .gitignore dvc_demo.txt.dvc
git commit -m "add dvc_demo.txt to dvc tracking"

Push the files to DAGsHub remotes

dvc push -r origin
git push
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...