随便一台电脑,写代码
作为开发人员,常常需要编写代码时,身边没有常用的电脑,这时可以使用本文的方法提高编码的体验。
核心思路:1、把公司的gitlab服务映射为公网ip+22/443端口;2、使用阿里云在线ide进行编码
部分1:
1、在自己的公网服务器上安装frp服务端(https://github.com/fatedier/frp/releases)、启动;把22、443端口释放出来。
2、在自己电脑,或者测试服务器上(能连通gitlab.p1staff.com),安装frp客户端,把22、443端口暴露为公网服务器的22、443


部分2:
1)打开https://ide.aliyun.com/,登陆阿里云账号
2)新建工作空间->通知git->填写部分1中映射出的公网ip->复制ssh Key,添加到gitlab的个人key列表->进入空间



3)打开终端,修改/etc/hosts 追加内容: 公网ip gitlab.p1staff.com


4)修改~/.zshrc
export GO111MODULE=on
export GOPROXY="[https://goproxy.cn](https://goproxy.cn),direct"
export GOPRIVATE="gitlab.p1staff.com"
5)git config --global url."git@gitlab.p1staff.com:".insteadOf "https://gitlab.p1staff.com/"
6)执行go mod tidy -v

-
尝试连接一次gitlab,从而gitlab服务添加到已知机器:ssh gitlab.p1staff.com
image.png
8)go mod tidy 下载好依赖后,代码可点击跳转,代码提示补全了

网友评论