File size: 7,443 Bytes
b1eb8e0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from git import Repo  # pip install gitpytho\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "ename": "GitCommandError",
     "evalue": "Cmd('git') failed due to: exit code(128)\n  cmdline: git clone -v -- https://github.com/krishnaadithya/ophthal_llm /Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/ophthal_llm\n  stderr: 'Cloning into '/Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/ophthal_llm'...\nfatal: could not read Username for 'https://github.com': Device not configured\n'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mGitCommandError\u001b[0m                           Traceback (most recent call last)",
      "\u001b[1;32m/Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/temp.ipynb Cell 2\u001b[0m line \u001b[0;36m1\n\u001b[0;32m----> <a href='vscode-notebook-cell:/Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/temp.ipynb#W4sZmlsZQ%3D%3D?line=0'>1</a>\u001b[0m Repo\u001b[39m.\u001b[39;49mclone_from(\u001b[39m\"\u001b[39;49m\u001b[39mhttps://github.com/krishnaadithya/ophthal_llm\u001b[39;49m\u001b[39m\"\u001b[39;49m, \u001b[39m\"\u001b[39;49m\u001b[39m/Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/ophthal_llm\u001b[39;49m\u001b[39m\"\u001b[39;49m)\n",
      "File \u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/git/repo/base.py:1328\u001b[0m, in \u001b[0;36mRepo.clone_from\u001b[0;34m(cls, url, to_path, progress, env, multi_options, allow_unsafe_protocols, allow_unsafe_options, **kwargs)\u001b[0m\n\u001b[1;32m   1326\u001b[0m \u001b[39mif\u001b[39;00m env \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m   1327\u001b[0m     git\u001b[39m.\u001b[39mupdate_environment(\u001b[39m*\u001b[39m\u001b[39m*\u001b[39menv)\n\u001b[0;32m-> 1328\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mcls\u001b[39;49m\u001b[39m.\u001b[39;49m_clone(\n\u001b[1;32m   1329\u001b[0m     git,\n\u001b[1;32m   1330\u001b[0m     url,\n\u001b[1;32m   1331\u001b[0m     to_path,\n\u001b[1;32m   1332\u001b[0m     GitCmdObjectDB,\n\u001b[1;32m   1333\u001b[0m     progress,\n\u001b[1;32m   1334\u001b[0m     multi_options,\n\u001b[1;32m   1335\u001b[0m     allow_unsafe_protocols\u001b[39m=\u001b[39;49mallow_unsafe_protocols,\n\u001b[1;32m   1336\u001b[0m     allow_unsafe_options\u001b[39m=\u001b[39;49mallow_unsafe_options,\n\u001b[1;32m   1337\u001b[0m     \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs,\n\u001b[1;32m   1338\u001b[0m )\n",
      "File \u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/git/repo/base.py:1237\u001b[0m, in \u001b[0;36mRepo._clone\u001b[0;34m(cls, git, url, path, odb_default_type, progress, multi_options, allow_unsafe_protocols, allow_unsafe_options, **kwargs)\u001b[0m\n\u001b[1;32m   1234\u001b[0m     cmdline \u001b[39m=\u001b[39m remove_password_if_present(cmdline)\n\u001b[1;32m   1236\u001b[0m     log\u001b[39m.\u001b[39mdebug(\u001b[39m\"\u001b[39m\u001b[39mCmd(\u001b[39m\u001b[39m%s\u001b[39;00m\u001b[39m)\u001b[39m\u001b[39m'\u001b[39m\u001b[39ms unused stdout: \u001b[39m\u001b[39m%s\u001b[39;00m\u001b[39m\"\u001b[39m, cmdline, stdout)\n\u001b[0;32m-> 1237\u001b[0m     finalize_process(proc, stderr\u001b[39m=\u001b[39;49mstderr)\n\u001b[1;32m   1239\u001b[0m \u001b[39m# our git command could have a different working dir than our actual\u001b[39;00m\n\u001b[1;32m   1240\u001b[0m \u001b[39m# environment, hence we prepend its working dir if required\u001b[39;00m\n\u001b[1;32m   1241\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m osp\u001b[39m.\u001b[39misabs(path):\n",
      "File \u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/git/util.py:453\u001b[0m, in \u001b[0;36mfinalize_process\u001b[0;34m(proc, **kwargs)\u001b[0m\n\u001b[1;32m    451\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"Wait for the process (clone, fetch, pull or push) and handle its errors accordingly\"\"\"\u001b[39;00m\n\u001b[1;32m    452\u001b[0m \u001b[39m# TODO: No close proc-streams??\u001b[39;00m\n\u001b[0;32m--> 453\u001b[0m proc\u001b[39m.\u001b[39;49mwait(\u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n",
      "File \u001b[0;32m/opt/homebrew/lib/python3.11/site-packages/git/cmd.py:600\u001b[0m, in \u001b[0;36mGit.AutoInterrupt.wait\u001b[0;34m(self, stderr)\u001b[0m\n\u001b[1;32m    598\u001b[0m     errstr \u001b[39m=\u001b[39m read_all_from_possibly_closed_stream(p_stderr)\n\u001b[1;32m    599\u001b[0m     log\u001b[39m.\u001b[39mdebug(\u001b[39m\"\u001b[39m\u001b[39mAutoInterrupt wait stderr: \u001b[39m\u001b[39m%r\u001b[39;00m\u001b[39m\"\u001b[39m \u001b[39m%\u001b[39m (errstr,))\n\u001b[0;32m--> 600\u001b[0m     \u001b[39mraise\u001b[39;00m GitCommandError(remove_password_if_present(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39margs), status, errstr)\n\u001b[1;32m    601\u001b[0m \u001b[39mreturn\u001b[39;00m status\n",
      "\u001b[0;31mGitCommandError\u001b[0m: Cmd('git') failed due to: exit code(128)\n  cmdline: git clone -v -- https://github.com/krishnaadithya/ophthal_llm /Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/ophthal_llm\n  stderr: 'Cloning into '/Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/ophthal_llm'...\nfatal: could not read Username for 'https://github.com': Device not configured\n'"
     ]
    }
   ],
   "source": [
    "Repo.clone_from(\"https://github.com/krishnaadithya/ophthal_llm\", \"/Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/ophthal_llm\", )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Repository cloned to /Users/aakashbhatnagar/Documents/masters/drvai-beta-deployment/deployment_app\n"
     ]
    }
   ],
   "source": [
    "import git\n",
    "\n",
    "# Replace 'your_username' with your GitHub username\n",
    "# Replace 'your_token' with your personal access token\n",
    "# Replace 'repo_url' with the URL of your private repository\n",
    "username = 'aakash0017'\n",
    "token = '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'\n",
    "repo_url = 'https://github.com/aakash0017/drvai-beta-deployment'\n",
    "\n",
    "# Construct the repository URL with the token\n",
    "repo_url_with_token = f'https://{username}:{token}@{repo_url.split(\"://\")[1]}'\n",
    "\n",
    "# Clone the repository\n",
    "repo = git.Repo.clone_from(repo_url_with_token, 'deployment_app')\n",
    "\n",
    "print(f\"Repository cloned to {repo.working_dir}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}