zl程序教程

您现在的位置是:首页 >  工具

当前栏目

CPython入门----Fork源码到自己github并下载配置本地git

2023-09-14 09:12:53 时间

更多信息请关注 个人网站

一、基础准备工作

(1)首先在github注册一个自己的账号
(2)在windows上安装git,可参考 Git安装----Windows10系统

二、Fork源码

(1)打开CPython的官方github地址,然后点击【fork】按钮
在这里插入图片描述
(2)此时即将源码fork到自己的github代码仓下了
在这里插入图片描述

三、下载到本地及git配置

(1)首先确保已经在github配置公钥,如未配置,请参考 github基础----配置公钥
(2)本地放代码的文件夹中右键-【git bash here】,打开git bash窗口
在这里插入图片描述
(3)在自己的代码仓中拷贝ssh类型的下载链接
在这里插入图片描述
(4)在(2)中打开的窗口中执行 git clone 操作,如:

Administrator@redrose2100-NJ MINGW64 /g/src
$ git clone git@github.com:redrose2100/cpython.git
Cloning into 'cpython'...
remote: Enumerating objects: 866263, done.
remote: Total 866263 (delta 0), reused 0 (delta 0), pack-reused 866263
Receiving objects: 100% (866263/866263), 419.90 MiB | 2.78 MiB/s, done.
Resolving deltas: 100% (687315/687315), done.
Updating files: 100% (4556/4556), done.

Administrator@redrose2100-NJ MINGW64 /g/src

(5)查看当前本地仓库与远端仓库的关联关系

Administrator@redrose2100-NJ MINGW64 /g/src
$ cd cpython/

Administrator@redrose2100-NJ MINGW64 /g/src/cpython (main)
$ git remote -v
origin  git@github.com:redrose2100/cpython.git (fetch)
origin  git@github.com:redrose2100/cpython.git (push)

Administrator@redrose2100-NJ MINGW64 /g/src/cpython (main)

(6)设置upstream关联关系,如下:

Administrator@redrose2100-NJ MINGW64 /g/src/cpython (main)
$ git remote add upstream git@github.com:python/cpython.git

Administrator@redrose2100-NJ MINGW64 /g/src/cpython (main)
$ git remote -v
origin  git@github.com:redrose2100/cpython.git (fetch)
origin  git@github.com:redrose2100/cpython.git (push)
upstream        git@github.com:python/cpython.git (fetch)
upstream        git@github.com:python/cpython.git (push)

Administrator@redrose2100-NJ MINGW64 /g/src/cpython (main)

CPython入门----Fork源码到自己github并下载配置本地git

CPython入门----下载安装Visual Studio 2017