#Astro on two machines and Git

1 messages · Page 1 of 1 (latest)

high anvil
#

Hello! I have a desktop computer and a laptop, and I would like to develop my astro site on both of these.

When I removed GitHub to clone my Astro repository to my laptop, Astro isn't found in the project folder. When I start with Astro, GitHub warns me about deploying into a non-empty folder.

How can I use GitHub to have the same Astro project on two computers?

worthy notchBOT
#

Hi @high anvil. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To use GitHub and have the same Astro project on two computers, you can follow these steps:

  1. Initialize your Astro project with Git and push it to GitHub from your desktop computer:

    • If you haven't already, create a new repository on GitHub.
    • In your project folder on your desktop, initialize Git, add all files, commit, and push to GitHub.
  2. On your laptop, clone the GitHub repository:

    • Use git clone <repository-url> to clone your project.
  3. After cloning, install the project dependencies:

    • Navigate to the cloned project folder.
    • Run npm install (or yarn install or pnpm install depending on your package manager).

This process ensures that you have the same Astro project on both computers, including all necessary files and dependencies.

The warning about deploying into a non-empty folder typically occurs when you try to create a new Astro project in a directory that already contains files (like a cloned Git repository). To avoid this, always clone your existing repository first, then install dependencies, rather than creating a new Astro project.

For managing your project across multiple devices, you can use Git's pull and push commands to keep your project in sync:

  • Before starting work on either machine, always git pull to get the latest changes.
  • After making changes, git add, git commit, and git push to update the GitHub repository.

For more detailed information on using Git with Astro, you can refer to the Astro documentation on deploying to GitHub Pages, which includes information on setting up Git for your Astro project.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: