Goland使用SSH远程Linux进行断点调试 (兼容私有库)

① 前置需求

  • ssh远程的 Linux 服务器必须安装 高于本地的 Go
  • 推荐golang 安装方式使用 apt yum snap 等系统自管理方式,(要安装最新版本的可以找找第三方源),如无特殊需求不要自行编译安装golang

Goland设置

2.1、设置项处理

2.2、设置Linux ssh地址和登录用户名

2.3、设置 Linux SSH 登录密码或者证书

2.4、新建 Go build 并且选择 Target

③ 远程 Linux 设置

3.1、在 ~/.gitconfig中添加如下代码,使Go 和 Git 对依赖的下载方式从htpps 改为ssh

复制代码
[url "ssh://git@github.com/"]
    insteadOf = https://github.com/

3.2、生成 有私有库访问权限的 ssh-key

复制代码
ssh-keygen -t ed25519 -C "" -f ~/.ssh/id_ed25519_private

3.3、编辑 ~/.ssh/config 增加私有库专用秘钥

  • 注意!!! private_repo_username_01private_repo_username_02 就是私有仓库的 用户名

  • 注意!!! private_repo_username_01private_repo_username_02 就是私有仓库的 用户名

  • 注意!!! private_repo_username_01private_repo_username_02 就是私有仓库的 用户名

    针对 private_repo_username_01 用户的私有 GitHub 仓库

    Match host github.com exec "git remote -v | grep 'private_repo_username_01' >/dev/null"
    IdentityFile ~/.ssh/id_ed25519_private
    IdentitiesOnly yes

    针对 private_repo_username_02 用户的私有 GitHub 仓库

    Match host github.com exec "git remote -v | grep 'private_repo_username_02' >/dev/null"
    IdentityFile ~/.ssh/id_ed25519_private
    IdentitiesOnly yes

④ Success

  • 好了可在运行或者右键面函数直接进行 debug run等操作了
相关推荐
geovindu5 分钟前
go: Proxy Pattern
开发语言·后端·设计模式·golang·代理模式
结衣结衣.15 分钟前
手把手教你实现文档搜索引擎
linux·c++·搜索引擎·开源·c++11
sdm0704271 小时前
进程间通信
linux·运维·服务器
蚰蜒螟1 小时前
Linux内核启动(init)与程序执行(execve)深度解析:从kernel_init到load_elf_binary
linux·运维·服务器
古城小栈1 小时前
hey 你好 “压测”
http·golang·开源
thethefighter1 小时前
信创综合档案管理系统单机版部署与使用
linux·银河麒麟·档案管理系统·单机版·nhdeep·信创版·综合档案管理系统
hhb_6181 小时前
Go高性能并发编程实战与底层原理剖析
运维·网络·golang
道清茗2 小时前
【RH294知识点汇总】第 6 章 《 管理复杂的 Play 和 Playbook 》常见问题
linux·服务器·网络
哼?~2 小时前
序列化与反序列化
linux·网络
broadview_java2 小时前
搬瓦工修改SSH端口
运维·网络·ssh