Push to github.com/org/repo=username/slug if tool exists.
    Returns username, commit hash
516214
def push(tool, slug, config_loader, prompt=lambda included, excluded: True):
    
    check_dependencies()

    org, (included, excluded) = connect(slug, config_loader)

    with authenticate(org) as user, prepare(tool, slug, user, included):
        if prompt(included, excluded):
            return upload(slug, user, tool)
        else:
            raise Error(_("No files were submitted."))
751904
function github(repo, clone) {
	let url;

	if (clone)
		url = 'git@' + repo.host + ':' + repo.owner + '/' + repo.name + '.git';
	else
		url = addProtocol(repo.host) + '/' + repo.owner + '/' + repo.name + '/archive/' + repo.checkout + '.zip';

	return url;
}
1086571
def get_branches(self, repo_slug=None):
        
        repo_slug = repo_slug or self.repo_slug or ''
        url = self.url('GET_BRANCHES',
                       username=self.username,
                       repo_slug=repo_slug)
        return self.dispatch('GET', url, auth=self.auth)
1276477
def edit(self, sha, force=github.GithubObject.NotSet):
        
        assert isinstance(sha, (str, unicode)), sha
        assert force is github.GithubObject.NotSet or isinstance(force, bool), force
        post_parameters = {
            "sha": sha,
        }
        if force is not github.GithubObject.NotSet:
            post_parameters["force"] = force
        headers, data = self._requester.requestJsonAndCheck(
            "PATCH",
            self.url,
            input=post_parameters
        )
        self._useAttributes(data)
804880
def get_commit_url(repo_url):
    """"""
    if "github.com" in repo_url:
        return repo_url[:-4] if repo_url.endswith(".git") else repo_url
    if "git.openstack.org" in repo_url:
        uri = '/'.join(repo_url.split('/')[-2:])
        return "https://github.com/{0}".format(uri)

    # If it didn't match these conditions, just return it.
    return repo_url
1363873
def install_plugin(username, repo):
    """"""
    print("Installing plugin from " + username + "/" + repo)

    pip.main(['install', '-U', "git+git://github.com/" +
              username + "/" + repo + ".git"])
50441
function gh(repo, project) {
  var base = 'https://github.com/'

  if (project) {
    repo = {user: repo, project: project}
  }

  if (repo) {
    base += repo.user + '/' + repo.project + '/'
  }

  return base
}
855160
def hook():
    """"""
    repo_id = request.json['id']

    github = GitHubAPI(user_id=current_user.id)
    repos = github.account.extra_data['repos']

    if repo_id not in repos:
        abort(404)

    if request.method == 'DELETE':
        try:
            if github.remove_hook(repo_id, repos[repo_id]['full_name']):
                db.session.commit()
                return '', 204
            else:
                abort(400)
        except Exception:
            abort(403)
    elif request.method == 'POST':
        try:
            if github.create_hook(repo_id, repos[repo_id]['full_name']):
                db.session.commit()
                return '', 201
            else:
                abort(400)
        except Exception:
            abort(403)
    else:
        abort(400)
128966
def _get_client(profile):
    '''
    
    '''
    token = _get_config_value(profile, 'token')
    key = 'github.{0}:{1}'.format(
        token,
        _get_config_value(profile, 'org_name')
    )

    if key not in __context__:
        __context__[key] = github.Github(
            token,
            per_page=100
        )
    return __context__[key]
710966
def _update_github(
            self):
        
        self.log.debug('starting the ``_update_github`` method')

        from subprocess import Popen, PIPE, STDOUT
        gdir = self.settings["sherlock wiki root"]
        cmd = """cd %(gdir)s && git add --all && git commit -m "x" && git pull origin master && git push origin master""" % locals()
        p = Popen(cmd, stdout=PIPE, stdin=PIPE, shell=True)
        output = p.communicate()[0]
        print output
        self.log.debug('output: %(output)s' % locals())

        self.log.debug('completed the ``_update_github`` method')
        return None
211084
def get_git_hash(from_url):
    
    from benchbuild.utils.cmd import git
    if from_url is None:
        return ""

    if not path.exists(from_url):
        return ""

    with local.cwd(from_url):
        return git("rev-parse", "HEAD", retcode=None)
273845
def deployed_by
      username = nil

      scm = fetch(:scm, nil)

      if scm
        if scm.to_sym == :git
          username = `git config user.name`.chomp
          username = nil if $? != 0 || username.strip == ''
        end
      end

      username || `whoami`.chomp
    end
274361
def online(note, github_repository, github_username):
    """"""
    callbacks.git_installed()
    try:
        repo = git.Repo()
    except git.InvalidGitRepositoryError:
        LOGGER.critical(
            "'memote online' requires a git repository in order to follow "
            "the current branch's commit history.")
        sys.exit(1)
    if note == "memote-ci access":
        note = "{} to {}".format(note, github_repository)

    # Github API calls
    # Set up the git repository on GitHub via API v3.
    gh_repo_name, auth_token, repo_access_token = _setup_gh_repo(
        github_repository,
        github_username,
        note
    )

    # Travis API calls
    # Configure Travis CI to use Github auth token then return encrypted token.
    secret = _setup_travis_ci(gh_repo_name, auth_token, repo_access_token)

    # Save the encrypted token in the travis config then commit and push
    LOGGER.info("Storing GitHub token in '.travis.yml'.")
    config = te.load_travis_configuration(".travis.yml")
    global_env = config.setdefault("env", {}).get("global")
    if global_env is None:
        config["env"]["global"] = global_env = {}
    try:
        global_env["secure"] = secret
    except TypeError:
        global_env.append({"secure": secret})
    te.dump_travis_configuration(config, ".travis.yml")
    LOGGER.info("Add, commit and push changes to '.travis.yml' to GitHub.")
    repo.index.add([".travis.yml"])
    check_call(
      ['git', 'commit', '-m', "chore: add encrypted GitHub access token"]
    )
    check_call(
      ['git', 'push', '--set-upstream', 'origin', repo.active_branch.name]
    )
281414
def public(self, username=None):
        
        username = username or self.bitbucket.username or ''
        url = self.bitbucket.url('GET_USER', username=username)
        response = self.bitbucket.dispatch('GET', url)
        try:
            return (response[0], response[1]['repositories'])
        except TypeError:
            pass
        return response
770971
def ask_github_password(username = nil)
      username ||= github_username
      print "Github password for #{username} (never stored): "
      if $stdin.tty?
        password = askpass
        puts ''
        password
      else
        # in testing
        $stdin.gets.chomp
      end
    rescue Interrupt
      abort
    end
1191375
def github_authenticated(cls, func):
        
        def inner(func_cls, *args, **kwargs):
            if not cls._gh_module:
                logger.warning('PyGithub not installed, skipping Github auth procedures.')
            elif not func_cls._user:
                # authenticate user, possibly also creating authentication for future use
                login = kwargs['login'].encode(utils.defenc) if not six.PY3 else kwargs['login']
                func_cls._user = cls._get_github_user(login, kwargs['ui'])
                if func_cls._user is None:
                    msg = 'Github authentication failed, skipping Github command.'
                    logger.warning(msg)
                    return (False, msg)
                # create an ssh key for pushing if we don't have one
                if not cls._github_ssh_key_exists():
                    cls._github_create_ssh_key()
                # next, create ~/.ssh/config entry for the key, if system username != GH login
                if cls._ssh_key_needs_config_entry():
                    cls._create_ssh_config_entry()
            return func(func_cls, *args, **kwargs)

        return inner
1203557
def main():
    
    args = parse_respect_args(sys.argv[1:])
    if validate_username(args['<username>']):
        print("processing...")
    else:
        print("@"+args['<username>'], "is not a valid username.")
        print("Username may only contain alphanumeric ASCII characters or "
              "dashes and cannot begin with a dash.")
        return
    try:
        r = requests.get(urljoin(GITHUB_USERS, args['<username>']))
    except ConnectionErrorException as e:
        print('Connection Error from requests. Request again, please.')
        print(e)

    if r.status_code == 404 or r.status_code == 403:
        session = login(401, args=args)
        return dispatch(args, r, session)

    elif r.status_code == 200:
        return dispatch(args, response=r)
    else:
        raise UnknownStausCodeException