VSCode GitHub and Clasp

44 views
Skip to first unread message

Michael O'Shaughnessy

unread,
Apr 5, 2020, 8:25:29 PM4/5/20
to Google Apps Script Community
My programming skills are evolving and I am finding myself using VSCode as an IDE.  It is great so far... I have created projects from "scratch" using clasp and even getting everything to be pushed to a GitHub repo.

My issue now is this... I have several GAS projects repos on GitHub.  I now want to work on them using VSCode however I cannot seem to find the "right way" to do this.  If I do a "git clone" of the repo I cannot get it connected to "clasp"... If I clone the "original script" using "clasp clone scriptID" I can't seem to get it connected to the repo that exists on GitHub.  I have done a "clasp clone script ID" and then created a NEW GitHub repo and got them connected BUT this means I will have a repo on GitHub that is basically useless... I guess I could delete the "useless" repo but to me there seems to be something that I am missing...

So what I need is the process of getting a GAS repo on GitHub into VSCode, get clasp connected and have it be able to update back to GitHub.... 

I hope this makes sense, if you need more info please let me know, if 

Amit Agarwal

unread,
Apr 5, 2020, 11:58:46 PM4/5/20
to google-apps-sc...@googlegroups.com
I wrote a tutorial on how to do local development with Apps Script using VS Code, GitHub and Clasp.


Hope it helps.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/ca2fa793-8bf9-4659-9210-7f3d4c04a594%40googlegroups.com.

Michael O'Shaughnessy

unread,
Apr 6, 2020, 10:40:49 PM4/6/20
to google-apps-sc...@googlegroups.com
@Amit Agarwal - Thank you and yes I did find your web page.  Right now it is to advanced for me... but I hope to be able to get there one day!! Just fyi, on the site it states to clone the "apps-script-start" repo but it is actually the "apps-script-starter" repo.  And by the way, I have visited your site many times.... very good information!

I can follow your process: use git to clone the repo, use claps to create a new project, create a new repo on GitHub, etc. and that is great.

However, I have been using the "Google Apps Script GitHub extension" will a lot of my projects.  So what I want to do is now use VSCode to continue to work on the projects I have on GitHub.  I can't seem to get a current GitHub repo that has my Google Apps Script code into VSCode to use clasp and git to continue working on it.



Taki Guan

unread,
Apr 7, 2020, 8:27:55 PM4/7/20
to Google Apps Script Community
You can use the extensiont to upload js file to GitHub then use git clone command to initialize local directory. After yow initialize the folder what you need to do is manually create a [.clasp.json] file inside the folder.

{
    "scriptId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Then you can use clasp pull or push.

Alex

unread,
Apr 9, 2020, 6:00:22 AM4/9/20
to Google Apps Script Community

Michael O'Shaughnessy

unread,
Apr 17, 2020, 11:47:45 PM4/17/20
to Google Apps Script Community
+Alex... Thank you for sharing your work!  It is very "over my head" right now HOWEVER it was very educational to watch you work!  I will be learning more and re-watching your videos.  Hopefully I will understand them more as I improve my skills!!
Reply all
Reply to author
Forward
0 new messages