Search code examples
google-apps-scriptclasp

Use .clasp.json to associate git repo with Apps Script project


I'd like to use clasp to develop Apps Script projects locally. Clasp has a built-in clone method which fetches a project by ID and pulls the code into a local directory. This also creates a .clasp.json file with some project settings.

The problem is that my code is already in a Git repo, so I'm wondering what the best method of getting the code locally would be. Is there a difference between these two methods?

  • Clone with git and then edit .clasp.json to point to the correct project id
  • Clone with clasp and then git init a repo and manually set the remote URL

...or does it not matter?


Solution

  • The two methods would work in the same fashion. They will both work and there is no different between them.

    However, this is a matter of taste and comfort rather than best-practice. In my opinion, the best method is the first one.