{"id":15514188,"url":"https://github.com/petems/go-sshconfig","last_synced_at":"2026-05-13T06:05:45.219Z","repository":{"id":57516666,"uuid":"245857735","full_name":"petems/go-sshconfig","owner":"petems","description":"A golang library for parsing and writing SSH config files","archived":false,"fork":false,"pushed_at":"2024-12-01T07:43:30.000Z","size":348,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T16:37:59.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/petems/go-sshconfig","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-08T17:28:29.000Z","updated_at":"2024-03-31T13:27:58.000Z","dependencies_parsed_at":"2024-11-13T08:45:06.549Z","dependency_job_id":null,"html_url":"https://github.com/petems/go-sshconfig","commit_stats":null,"previous_names":["petems/sshconfig"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petems%2Fgo-sshconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petems%2Fgo-sshconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petems%2Fgo-sshconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petems%2Fgo-sshconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petems","download_url":"https://codeload.github.com/petems/go-sshconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241455452,"owners_count":19965611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:57:54.195Z","updated_at":"2026-05-13T06:05:45.123Z","avatar_url":"https://github.com/petems.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-sshconfig\n[![Build Status](https://travis-ci.com/petems/go-sshconfig.svg?branch=master)](https://travis-ci.com/petems/go-sshconfig)[![](https://godoc.org/github.com/petems/go-sshconfig?status.svg)](http://godoc.org/github.com/petems/go-sshconfig)[![Go Report Card](https://goreportcard.com/badge/github.com/petems/go-sshconfig)](https://goreportcard.com/report/github.com/petems/go-sshconfig)\n\nA simple [ssh_config](https://man.openbsd.org/ssh_config) parser/writer library\n\n## Example\n\nAn app to add a global config entry to a config file:\n\n```\n    sshConfigFile := os.ExpandEnv(\"$HOME/.ssh/config\")\n\n\tfile, err := os.Open(sshConfigFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tconfig, err := sshconfig.Parse(file)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfile.Close()\n\n\t// modify by reference for existing params\n\t// or create a new param and append it to global\n\tif param := config.GetParam(sshconfig.VisualHostKeyKeyword); param != nil {\n\t\tfmt.Println(\"VisualHostKey found! Switching to value: yes\")\n\t\tparam.Args = []string{\"yes\"}\n\t\tparam.Comments = []string{\"Added by the petems/go-sshconfig example app\"}\n\t} else {\n\t\tfmt.Println(\"VisualHostKey not found! Adding with value: yes\")\n\t\tparam = sshconfig.NewParam(sshconfig.VisualHostKeyKeyword, []string{\"yes\"}, []string{\"Added by the petems/go-sshconfig example app\"})\n\t\tconfig.Globals = append(config.Globals, param)\n\t}\n\n    fmt.Println(config)\n```\n\n`$HOME/.ssh/config` contents:\n\n```\nHost github.com\n  ControlMaster auto\n  ControlPath ~/.ssh/ssh-%r@%h:%p\n  ControlPersist yes\n  User git\n``` \n\nOutput:\n\n```\nVisualHostKey not found! Adding with value: yes\n# global configuration\n\n# Added by the petems/go-sshconfig example app\nVisualHostKey yes\n\n# host-based configuration\n\nHost github.com\n  ControlMaster auto\n  ControlPath ~/.ssh/ssh-%r@%h:%p\n  ControlPersist yes\n  User git\n```\n\nThe best way to go deeper is to read the [docs](https://godoc.org/github.com/petems/go-sshconfig).\n\n## Attribution\n\nForked and refactored from [emptyinterface/sshconfig/](https://github.com/emptyinterface/sshconfig/)\n\n## Development\nIf you'd like to other features or anything else, check out the contributing guidelines in [CONTRIBUTING.md](CONTRIBUTING.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetems%2Fgo-sshconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetems%2Fgo-sshconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetems%2Fgo-sshconfig/lists"}