Skip to content

Instantly share code, notes, and snippets.

View adrians5j's full-sized avatar
🏠
Working from home

Adrian Smijulj adrians5j

🏠
Working from home
View GitHub Profile
@SimplGy
SimplGy / addFileToGit.js
Last active October 6, 2021 12:38
Usage: `addFileToGit(foo.txt, "some file contents")`. Uses the "octokit" to add a single file to your gitub repo. Adapted from a Ruby guide by http://mattgreensmith.net
const Octokit = require('@octokit/rest'); // https://octokit.github.io/rest.js/
// Customize this stuff:
const auth = 'your-key-generated-in-github-ui'; // PRIVATE!
const owner = 'repo-owner';
const repo = 'your-repo-name';
// Constants
const userAgent = 'git commiter v1';
const ref = 'heads/master';