DN42 - 注册AS

小白第一次注册DN42过程记录。也是第一回使用git,记录一些弯路。

一、前期准备

1. 环境

操作系统:Ubuntu 20.04(啥操作系统都行,主要是方便使用git就可以)

2. 工具

git + vscode(大多数编辑器都行)

git的话,网上教程有很多。主要掌握(后面主要涉及):clone,check,push,add,commit,push,fetch,rebase,branch,log命令。

还要建立git和Gitea之间的SSH authentication。

本地电脑执行:

ssh-keygen -t rsa -C “xxxxxxxx”

然后找到~/.ssh目录下的公钥id_rsa.pub,复制到Gitea上的SSH Keys配置中。

二、注册流程

参考dn42/registry里的README.md

1. Create a local clone of the registry repository

git clone git@git.dn42.dev:dn42/registry.git

在这里插入图片描述
可以根据.git文件的位置来确定仓库的位置(根目录)。(第一回clone的时候,以为根目录需要自己init,后来发现并不用)

2. Create a branch for your changes

# create a new branch and switch to it

git checkout -b <username>-YYYYMMDD/<name>

# push it immediately to the registry

git push --set-upstream origin <username>-YYYYMMDD/<name>

在这里插入图片描述

3. Make your changes on your new branch

补充AS的注册数据,可以参考官方的wiki或者网上的一些教程,挺多的。

DN42中空闲的ASN、IPv4和IPv6可以在DN42 Free Explorer里面寻找。

DN42中已经注册的信息可以看dn42.us registry

配置完data之后,运行下检测程序。我这好像没啥问题。

./fmt-my-stuff MNTNER-MNT
./check-my-stuff MNTNER-MNT
./check-pol origin/master MNTNER-MNT

git add .
git commit

在这里插入图片描述

4. Push your changes back to the registry

如果有多次commit,一定要squash到一个commit里。
而且在commit之前,要先fetch一下最新的仓库。

./squash-my-commits
git push --force

或者

# make sure your local copy of the master is up to date

git fetch origin master

# ensure you are using your new branch

git checkout foo-20200704/mychange
# rebase your branch on top of the master
#
# -i to interactively pick the commits
# -S to sign the result with your GPG key (not required for SSH authentication)
#
# In interactive mode, make sure the first commit says ‘pick’
# change the rest from ‘pick’ to ‘squash’
# save and close to create the commit

git rebase -i -S origin/master

# force push your changes back to the registry

git push --force

5. Create a pull request

我在这使用的是SSH authentication,因此需要将此次commit对应的commit hash和对应的SSH signature跟着Pull Request一块儿提交。

通过以下指令,获取对应的SSH signature:

echo “<commit hash>” | ssh-keygen -Y sign -f ~/.ssh/id_rsa -n dn42

然后,提交SSH signature时,需要将

-----BEGIN SSH SIGNATURE-----
# 和
-----END SSH SIGNATURE-----

也粘贴进去。不然验证会报错。

验证这块可以参考:How Authentication Works

6. Making updates

在审核的过程中,可能会有新的分支被合并进主分支了,所以需要Update一下。主要参考4. Push your changes back to the registry。

但是有可能会出现多个commit。多个commit需要进行squash,管理员给的建议是:

$ ./squash-my-commits -S --push

然而好像没啥用。

我用4. Push your changes back to the registry下面的rebase的方法,可以成功squash。

现在在等着merge。

三、参考

DN42
DN42 实验网络介绍及注册教程(2022-02 更新)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值