How to use the isomorphic-git.push function in isomorphic-git

To help you get started, weโ€™ve selected a few isomorphic-git examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github telstra / openapi-platform / packages / git-util / src / index.ts View on Github external
}
    logger.verbose(`Committing changes...`);
    await commit({
      fs: oldFs,
      dir: repoDir,
      // TODO: This should be configurable
      author: {
        name: 'Swagger Platform',
        email: 'N/A',
      },
      // TODO: Could have a better message
      message: 'Updated SDK',
    });

    logger.verbose(`Pushing commits...`);
    await push({
      fs: oldFs,
      dir: repoDir,
      ...gitInfo.auth,
    });
  } catch (err) {
    throw err;
  } finally {
    await deletePaths([repoDir]);
  }
}
github casual-simulation / aux / WebClient / GitManager.ts View on Github external
async pushIfNeeded(branchName: string): Promise {
        console.log(`[GitManager] Pushing "${this.localUserBranch}"...`);

        const remoteCommit = await this.resolveRef(this.remoteUserBranch);
        const localCommit = await this.resolveRef(this.localUserBranch);

        if (remoteCommit !== localCommit) {
            await push({
                dir: this.projectDir,
                ref: this.localUserBranch,
                username: this.username,
                password: this.password
            });
            console.log(`[GitManager] Pushed.`);
        } else {
            console.log(`[GitManager] Push not needed.`);
        }
    }
github casual-simulation / aux / WebClient / GitManager.ts View on Github external
async checkoutOrCreate(branchName: string): Promise {
        console.log(`[GitManager] Checking out "${this.localUserBranch}"...`);
        try {
            await this._checkout(branchName);
        } catch(err) {
            await branch({
                dir: this.projectDir,
                ref: branchName
            });

            await this._checkout(branchName);

            await push({
                dir: this.projectDir,
                ref: branchName,
                username: this.username,
                password: this.password
            });
        }
    }
github CleverCloud / clever-tools / src / models / git.js View on Github external
async function push (remoteUrl, branchRefspec, force) {
  const repo = await getRepo();
  const tokens = await loadOAuthConf().toPromise();
  try {
    const push = await git.push({
      ...repo,
      username: tokens.token,
      password: tokens.secret,
      url: remoteUrl,
      ref: branchRefspec,
      remoteRef: 'master',
      force,
    });
    if (push.errors != null) {
      throw new Error(push.errors.join(', '));
    }
    return push;
  }
  catch (e) {
    if (e.code === 'PushRejectedNonFastForward') {
      throw new Error('Push rejected because it was not a simple fast-forward. Use "--force" to override.');