<commit_before>var http   = require("https");
var CONFIG = require("./config");
var sys    = require('sys');
var exec   = require('child_process').exec;

var PER_PAGE = 100;
var repos = [];

getAllRepos (1, function (repos) {
  getCurrentUser (function (current_user) {
    for (var index in repos) {
      var current_repo_owner = repos[index].owner.login;
      var current_repo_name = repos[index].owner.name;

      if (current_user == current_repo_owner) {
        var ssh_repo_address = repos[index].ssh_url
        console.log (ssh_repo_address);

        exec ("cd Repositories && git clone " + ssh_repo_address + " && cd ..", function (error, stdout, stderr) {
          if (error) {
            console.log (error)
          }

          console.log (stdout)
        })
      }
    }
  })
});

function getCurrentUser (callback) {
  var options = {
    host: "api.github.com",
    port: 443,
    path: "/user",
    method: 'GET',
    headers: {
      "Authorization": "token " + CONFIG.GITHUB_TOKEN,
      "User-Agent": "git-tools-cloner"
    }
  };

  var req = http.request(options, function(res) {
    var username = "";

    res.setEncoding('utf8');<commit_msg>use repo address from config<commit_after>var http   = require("https");
var CONFIG = require("./config");
var sys    = require('sys');
var exec   = require('child_process').exec;

var PER_PAGE = 100;
var repos = [];

getAllRepos (1, function (repos) {
  getCurrentUser (function (current_user) {
    for (var index in repos) {
      var current_repo_owner = repos[index].owner.login;
      var current_repo_name = repos[index].owner.name;

      if (current_user == current_repo_owner) {
        var ssh_repo_address = repos[index].ssh_url
        console.log (ssh_repo_address);

        exec ("cd " + CONFIG.REPOSITORIES + " && git clone " + ssh_repo_address, function (error, stdout, stderr) {
          if (error) {
            console.log (error)
          }

          console.log (stdout)
        })
      }
    }
  })
});

function getCurrentUser (callback) {
  var options = {
    host: "api.github.com",
    port: 443,
    path: "/user",
    method: 'GET',
    headers: {
      "Authorization": "token " + CONFIG.GITHUB_TOKEN,
      "User-Agent": "git-tools-cloner"
    }
  };

  var req = http.request(options, function(res) {
    var username = "";

    res.setEncoding('utf8');
{'fraction_non_alphanumeric': 0.1437024513947591, 'fraction_numerical': 0.006762468300929839, 'mean_word_length': 2.6359447004608296, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4374678', 'n_tokens_mistral': 796, 'n_tokens_neox': 755, 'n_words': 174}