Closed ddkwork closed 8 months ago
We could add a section for GitHub CLI commands to the command menu.
We could add a section for GitHub CLI commands to the command menu.
I tested the "gh repo clone" command without extended parameters to clone submodule, a bit of a pity, but cli access to github in China is quite stable, other countries with access restrictions should be the same, I am ready to make a githubApp to complete the desktop platform and mobile platform github client to solve the access problem, at present, github official github mobile works very well, but some of the features of the web version are missing, For example, the code search function is very chicken.,The function of updating the fork repository is not.,There is no fork repository menu.,No deletion of the repository.,Modify the commit name.,Merge multiple commits.,Clean up and compress the repository.,Star management is not very powerful.,I vaguely feel that the Android platform is not limited by the implementation of file system monitoring:It's better to monitor the .git directory in the sd directory.,But the above mentioned functions seem to be implemented in gh.,I'll read the gh code further to see the repo. The clone command is not heavily dependent on the git system.
When I further tested the gh subcommand, I found that it can only pull but not push, so don't support gh anymore, cli is only suitable for a github client
You can push and pull with git
, you only need gh
for issues and PRs, right?
No, I need a fairly stable network environment to operate git's pull push, pr issue, etc. At present, it is such a bad situation in China: within 30 minutes, I may be able to access github for 5 minutes, at this time I can successfully operate git related commands, the bad thing is that it will not give me this time continuously in just a few minutes, it is random, for this reason I used image repositories before, and before for the convenience of pr and update fork, I had no choice but to delete some image repositories and use vpn. Interestingly: you may find that I can often reply to the issued and browse the github repository normally, this is a long time ago one day, I installed github mobile, found that it access is very stable, in the further investigation found that: it should be called the github cli repository in the api.github xxx and other public APIs, before this I tried the official API to provide the public IP to write hosts, but unfortunately not very stable
---Original--- From: @.> Date: Tue, Feb 20, 2024 06:22 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/cogent] code: vcs (Issue #312)
You can push and pull with git, you only need gh for issues and PRs, right?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
So is it possible for Cogent Code to communicate directly with those GitHub APIs that you can access?
This is the case with all github-related URLs, which are not well accessible, and sometimes it is a luxury to look at the demo png, gist, etc. of a repository
---Original--- From: @.> Date: Tue, Feb 20, 2024 06:22 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/cogent] code: vcs (Issue #312)
You can push and pull with git, you only need gh for issues and PRs, right?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
Yes, the API https://api.github.com/ is public, anyone can use it, we just need to make a GitHub login process like Goland's VCS page and save the token in a certain location, and then read the token in the directory tree of code and right-click in the directory tree, etc., and read the things needed in the token https://api.github.com/ can be accessed as the web version
---Original--- From: @.> Date: Tue, Feb 20, 2024 07:19 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/cogent] code: vcs (Issue #312)
So is it possible for Cogent Code to communicate directly with those GitHub APIs that you can access?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
I've always suspected that I didn't understand this correctly, and in theory this is the best solution, but when I take out all the IPs in ICDR format and ping it, I find that it doesn't work
Hi, my English is not good, can you help me check my conversion code? Wait a minute for me to find that code.
```go package main import ( _ "embed" "encoding/json" "net" "cogentcore.org/core/gi" "github.com/ddkwork/golibrary/mylog" "github.com/ddkwork/golibrary/stream" "github.com/ddkwork/golibrary/stream/net/httpClient" "github.com/ddkwork/golibrary/widget" ) //go:generate core generate //go:generate core build -v -t android/arm64 //go:generate core build -v -t windows/amd64 //go:generate go build . //go:generate go install . //go:generate svg embed-image 1.png //go:embed ghips.go var icon []byte // https://faststone-photo-resizer.en.lo4d.com/windows func main() { ips() return // icons.AddFS() gi.TheApp.SetIconBytes(icon) b := gi.NewBody("ghips") widget.NewWindowRunAndWait(b, func(names []string) { }) } var webhookIpNets []*net.IPNet func ips() { for _, cidr := range []string{ "192.30.252.0/22", "185.199.108.0/22", "140.82.112.0/20", "143.55.64.0/20", "2a0a:a440::/29", "2606:50c0::/32", } { _, ipNet, err := net.ParseCIDR(cidr) if !mylog.Error(err) { return } webhookIpNets = append(webhookIpNets, ipNet) } url := "https://api.github.com/meta" c := httpClient.New().Url(url).Get() if !c.Request() { return } m := new(Meta) if !mylog.Error(json.Unmarshal(c.ResponseBufStream().Bytes(), m)) { return } mylog.Struct(m) stream.WriteTruncate("meta.json", c.ResponseBufStream().JsonIndent()) } var ( path = "C:\\Windows\\System32\\drivers\\etc\\hosts" orig = ` # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost ` ) var dots = []string{ "avatars1.githubusercontent.com", "www.github.com", "camo.githubusercontent.com", "avatars7.githubusercontent.com", "raw.github.com", "avatars8.githubusercontent.com", "avatars0.githubusercontent.com", "avatars3.githubusercontent.com", "avatars4.githubusercontent.com", "avatars5.githubusercontent.com", "marketplace-screenshots.githubusercontent.com", "gist.githubusercontent.com", "gist.github.com", "cloud.githubusercontent.com", "repository-images.githubusercontent.com", "user-images.githubusercontent.com", "assets-cdn.github.com", "avatars2.githubusercontent.com", "raw.githubusercontent.com", "avatars6.githubusercontent.com", "desktop.githubusercontent.com", "github.com", } // 20.200.245.247 avatars1.githubusercontent.com // 20.200.245.247 www.github.com // 20.200.245.247 camo.githubusercontent.com // 20.200.245.247 avatars7.githubusercontent.com // 20.200.245.247 raw.github.com // 20.200.245.247 avatars8.githubusercontent.com // 20.200.245.247 avatars0.githubusercontent.com // 20.200.245.247 avatars3.githubusercontent.com // 20.200.245.247 avatars4.githubusercontent.com // 20.200.245.247 avatars5.githubusercontent.com // 20.200.245.247 marketplace-screenshots.githubusercontent.com // 20.200.245.247 gist.githubusercontent.com // 20.200.245.247 cloud.githubusercontent.com // 20.200.245.247 repository-images.githubusercontent.com // 20.200.245.247 user-images.githubusercontent.com // 20.200.245.247 assets-cdn.github.com // 20.200.245.247 avatars2.githubusercontent.com // 20.200.245.247 raw.githubusercontent.com // 20.200.245.247 avatars6.githubusercontent.com // 20.200.245.247 desktop.githubusercontent.com // 20.200.245.247 github.com type Meta struct { VerifiablePasswordAuthentication bool `json:"verifiable_password_authentication"` SshKeyFingerprints struct { SHA256ECDSA string `json:"SHA256_ECDSA"` SHA256ED25519 string `json:"SHA256_ED25519"` SHA256RSA string `json:"SHA256_RSA"` } `json:"ssh_key_fingerprints"` SshKeys []string `json:"ssh_keys"` Hooks []string `json:"hooks"` Web []string `json:"web"` Api []string `json:"api"` Git []string `json:"git"` GithubEnterpriseImporter []string `json:"github_enterprise_importer"` Packages []string `json:"packages"` Pages []string `json:"pages"` Importer []string `json:"importer"` Actions []string `json:"actions"` Dependabot []string `json:"dependabot"` Domains struct { Website []string `json:"website"` Codespaces []string `json:"codespaces"` Copilot []string `json:"copilot"` Packages []string `json:"packages"` Actions []string `json:"actions"` } `json:"domains"` } //////////////////////test package main import ( "net" "testing" "github.com/ddkwork/golibrary/mylog" "github.com/ddkwork/golibrary/stream" "github.com/ddkwork/golibrary/stream/cmd" ) func Test_Cidr(t *testing.T) { cidrs := []string{ // 没有github apk稳定,得研究下它的获取ip方式 "185.199.108.0/22", "20.200.245.247/32", } ip, ipNet, err := net.ParseCIDR(cidrs[0]) if !mylog.Error(err) { return } ipss := make([]string, 0, ipNet.Mask[0]) to4 := ip.To4() for i := int(to4[3]); i <= int(ipNet.Mask[0]); i++ { to4[3] = byte(i) ipss = append(ipss, to4.String()) } // mylog.Struct(ipss) s := stream.New(orig) for _, dot := range dots { s.WriteStringLn(ipss[len(ipss)-1] + " " + dot) } stream.WriteTruncate(path, s.String()) cmd.Run("ipconfig /flushdns") } //手动 //添加hosts //访问 https://hosts.gitcdn.top/hosts.txt , 将其全部内容粘贴到你的hosts文件中,即可。 // //Linux / MacOS hosts路径:/etc/hosts //Windows hosts路径:C:\Windows\System32\drivers\etc\hosts //刷新生效 //Linux: /etc/init.d/network restart //Windows: ipconfig /flushdns //Macos: sudo killall -HUP mDNSResponder //Unix/Linux 一键使用 //sed -i "/# fetch-github-hosts begin/Q" /etc/hosts && curl https://hosts.gitcdn.top/hosts.txt >> /etc/hosts //提示:可以设置crontab定时任务定时获取更新即可,解放双手! ```
I don't think modifying the hosts file is going to get around a country-wide firewall.
Is there a better solution? My machine doesn't have any anti-software.,Administrator account login.,The anti-virus software that comes with Windows has also been deleted.,All local machines are completely open.。 Do you mean that modifying hosts in addition to the local machine can't bypass the network provider's firewall check on the remote server?
---Original--- From: @.> Date: Tue, Feb 20, 2024 08:08 AM To: @.>; Cc: @.>;"State @.>; Subject: Re: [cogentcore/cogent] code: vcs (Issue #312)
I don't think modifying the hosts file is going to get around a country-wide firewall.
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>
Describe the feature
I've found that all areas where you can't access GitHub can be accessed with CLI very well, so can you support GH in VCS?
https://github.com/cli/cli
Relevant code
No response