571
社区成员
发帖
与我相关
我的任务
分享 先在GitHub上面Create a new repository。

然后把项目clone到本地。
PS F:\CodeWorkStations\GitStation\menu> git clone https://github.com/PrearWing/menu.git
Cloning into 'menu'...
warning: You appear to have cloned an empty repository.
打开VSCode,打开刚才clone的项目。因为在VSCode中配置了使用Git Bash,现在可以看到是成功创建了版本库并且顺利打开了。

进入Extensions后直接搜索go进行安装。

新建go文件,看是否配置完成。结果发现还有东西没安装,继续安装。

但是老是报错。这里参考了VSCode 安装 Go 插件失败解决方案。使用如下命令可解决:
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct

新建go文件,编写代码。

运行查看结果:

24173@DESKTOP-22U5NA6 MINGW64 /f/CodeWorkStations/GitStation/menu (main)
$ git add *
24173@DESKTOP-22U5NA6 MINGW64 /f/CodeWorkStations/GitStation/menu (main)
$ git commit -m "Hello World"
[main (root-commit) d18dfc9] Hello World
1 file changed, 7 insertions(+)
create mode 100644 main/main.go
24173@DESKTOP-22U5NA6 MINGW64 /f/CodeWorkStations/GitStation/menu (main)
$ git push origin main
fatal: unable to access 'https://github.com/PrearWing/menu.git/': OpenSSL SSL_connect: Connection was reset in connection to github.com:443
运行到这里报错,查阅资料发现是代理的问题。参考解决github无法连接错误 OpenSSL SSL_connect: Connection was reset in connection to github.com:443 ,然后接着尝试。
24173@DESKTOP-22U5NA6 MINGW64 /f/CodeWorkStations/GitStation/menu (main)
$ git push origin main
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
warning: ----------------- SECURITY WARNING ----------------
warning: | TLS certificate verification has been disabled! |
warning: ---------------------------------------------------
warning: HTTPS connections may not be secure. See https://aka.ms/gcm/tlsverify for more information.
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 12 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 315 bytes | 315.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
To https://github.com/PrearWing/menu.git
* [new branch] main -> main
在这个过程中,它会弹出提示框让你选择登录GitHub账户的方式,按照提示操作即可。

大功告成。
作者:465