{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# **JupyterLab 基本操作**\n",
    "带学员了解 JupyterLab 实训的基本操作。"
   ]
  },
  {
   "attachments": {
    "7133b325-908d-496d-8bb2-ee16a6c051a8.png": {
     "image/png": "[encoded data, 57468 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **创建 JupyterLab 实训项目**\n",
    "在新建实训项目里面，创建 JupyterLab 实训项目，填写实训的标题以及简介。\n",
    "![image.png](attachment:7133b325-908d-496d-8bb2-ee16a6c051a8.png)"
   ]
  },
  {
   "attachments": {
    "2342f2e1-2776-41df-8942-ed5931308ed0.png": {
     "image/png": "[encoded data, 73232 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "设置实训的运行环境，以及类别。\n",
    "![image.png](attachment:2342f2e1-2776-41df-8942-ed5931308ed0.png)\n",
    "\n",
    "设置好了之后就可以点击**保存**，实训创建完成。"
   ]
  },
  {
   "attachments": {
    "db7d64e2-a65b-4710-b359-c2f0b4afea4e.png": {
     "image/png": "[encoded data, 347876 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **上传代码文件**\n",
    "在创建完实训后，我们会在这个默认的界面，这时候我们要做的就是上传代码文件。\n",
    "![image.png](attachment:db7d64e2-a65b-4710-b359-c2f0b4afea4e.png)"
   ]
  },
  {
   "attachments": {
    "fa4ed921-8654-4e7c-b6e6-5e294c17c3bb.png": {
     "image/png": "[encoded data, 90168 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "点击设置，进入实训编辑界面，我们看到代码仓库界面。\n",
    "![image.png](attachment:fa4ed921-8654-4e7c-b6e6-5e294c17c3bb.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在代码仓库界面，我们可以在红色的区域直接上传代码，也可以通过代码仓库地址使用 git 进行本地上传，当然一般使用到 JupyterLab 实训，那项目文件偏多，这里推荐使用 git 上传。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **git 本地上传**\n",
    "\n",
    "git 工具下载链接： https://git-scm.com/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\ngit clone {}\\n'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# github复制的仓库地址\n",
    "\"\"\"\n",
    "git clone {}\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\ncd {}\\n'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 仓库地址\n",
    "\"\"\"\n",
    "cd {}\n",
    "\"\"\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\ngit add .\\n'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#  上传单个文件的话写文件名    . 为全部的 意思\n",
    "\"\"\"\n",
    "git add .\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"\\ngit commit -m '描述'\\n\""
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 提交\n",
    "\"\"\"\n",
    "git commit -m '描述'\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\ngit push origin master\\n'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 更新到远程仓库\n",
    "\"\"\"\n",
    "git push origin master\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\ngit config --global user.name \"Sallenkey\"\\ngit config --global user.email \"xxx@163.com\"\\n'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 如果是第一次上传会出现输入用户名邮箱密码等提示，照显示步骤输入\n",
    "# 配置全局用户名和密码\n",
    "\"\"\"\n",
    "git config --global user.name \"Sallenkey\"\n",
    "git config --global user.email \"xxx@163.com\"\n",
    "\"\"\""
   ]
  },
  {
   "attachments": {
    "396274c5-c486-49b0-8114-f1f3d1bab790.png": {
     "image/png": "[encoded data, 174644 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **切换环境**\n",
    "我们在像切换环境的时候，可以在这里切换环境，记得切换后一定要**重置环境**才能生效。\n",
    "![image.png](attachment:396274c5-c486-49b0-8114-f1f3d1bab790.png)"
   ]
  },
  {
   "attachments": {
    "fe0fdaff-b3e4-4d16-9e07-75be6ed1e186.png": {
     "image/png": "[encoded data, 114900 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **服务**\n",
    "这里的服务其实就是一个文件打开的默认文件显示，可以从上面看出我们创建实训的时候，是没有默认的文件显示的，而显示就是在系统的根目录。\n",
    "\n",
    "而现在我们要从服务里面，点击设置，选择文件并设置为默认打开文件。\n",
    "![image.png](attachment:fe0fdaff-b3e4-4d16-9e07-75be6ed1e186.png)"
   ]
  },
  {
   "attachments": {
    "51cebf6c-41a7-46ab-8885-7ed1adfb4069.png": {
     "image/png": "[encoded data, 71776 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "确定等待一会，就显示设置完成了。\n",
    "![image.png](attachment:51cebf6c-41a7-46ab-8885-7ed1adfb4069.png)"
   ]
  },
  {
   "attachments": {
    "4157a613-b8fd-4a0d-ab72-ab670cc8253f.png": {
     "image/png": "[encoded data, 310968 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### **使用说明**\n",
    "返回实训界面，就可以看到设置成功了。\n",
    "![image.png](attachment:4157a613-b8fd-4a0d-ab72-ab670cc8253f.png)\n"
   ]
  },
  {
   "attachments": {
    "3b07d026-98f2-48bb-9fc6-013866e95b67.png": {
     "image/png": "[encoded data, 311284 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "切记，不能在这里上传文件，这里上传不能更新到原来的实训。\n",
    "![image.png](attachment:3b07d026-98f2-48bb-9fc6-013866e95b67.png)"
   ]
  },
  {
   "attachments": {
    "f7c56fc5-4a96-44e9-9474-5ea77dec6c64.png": {
     "image/png": "[encoded data, 133224 characters]"
    }
   },
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "每一个修改实训的内容，下载到本地再上传到代码仓库进行覆盖更新。\n",
    "![image.png](attachment:f7c56fc5-4a96-44e9-9474-5ea77dec6c64.png)"
   ]
  },
  {
   "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.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
