Files in Docker instance to Github?

Syncing GitHub from Jupyter Notebook refers to the process of keeping your Jupyter Notebook files up-to-date with a remote GitHub repository. This allows you to collaborate on Jupyter Notebooks with others, track changes to your notebooks over time, and easily share your work with others.

Here are the basic steps involved in syncing GitHub from Jupyter Notebook:

  1. Open Terminal in the docker instance
  2. Install Git in the docker using below commands:
    • apt-get -y update
    • apt update
    • apt install git
    • git –version
  3. Setting the user in the config file:
    • git config –global user.name <USER NAME>
    • git config –global user.email <useremail>
  4. Check entries in the Config file:
    • git config –list
  5. Create a GitHub repository: If you don’t already have a GitHub repository for your project, you’ll need to create one. This will be the remote repository where you’ll store your Jupyter Notebook files.
  6. Clone the repository: Clone the remote repository to your local computer. This will create a local copy of the repository on your computer.
    • git clone https://github.com/<repository>
  7. Connect Jupyter Notebook to the repository: Open Jupyter Notebook and navigate to the directory where you cloned the repository.
  8. Make changes to your notebooks: Once connected, you can make changes to your Jupyter Notebook files as usual. Jupyter Notebook will automatically track these changes.
  9. Add files / folder to git:
    • Add Folder: git add <folder>
    • Add files:
      • git add *.csv
      • git add *.ipynb
      • git add *.txt
    • Check Status:
      • git status
  10. Commit the changes:
    • git commit -m “Commit Initial Version”
  11. Generate Personal Access Token (PAT): If you have not generate personal access token, use below steps to generate the PAT:
    • Login to GitHub
    • Navigate to “Profile -> Settings -> Developer Settings -> Personal Access Tokens -> Tokens(Classic)”
    • Click “Generate new token”
    • Select appropriate options in the “Generate new token” window and click on Generate
    • Save the token for future use
  12. Push changes: When you’re ready to share your changes, you’ll need to push them to the remote repository. This will upload your changes to GitHub and make them available to others.
    • git push -u origin main
    • Enter username of GitHub
    • Under password field, enter copied personal access token (PAT) and click on Enter. This will sync files to GitHub

Syncing GitHub from Jupyter Notebook is a great way to collaborate on Jupyter Notebooks and keep your work organized. With a little practice, you’ll be able to sync your notebooks quickly and easily.

1 thought on “Files in Docker instance to Github?”

Leave a Comment

Your email address will not be published. Required fields are marked *