fixer
December 8, 2024, 5:49pm
1
I’m trying to setup a project as a zig package, but I ran into a problem. I’m on zig v0.13.0 and when I try to fetch my package I get a ProtocolError
$ zig fetch --save git+https://github.com/epizzella/RTOS/tree/zon
error: unable to discover remote git server capabilities: ProtocolError
I’m able to fetch other zig packages so I must have something setup wrong in my repository.
zig.build:
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
_ = b.addModule("RTOS", .{
.root_source_file = b.path("os.zig"),
.target = target,
.optimize = optimize,
});
}
build.zig.zon
.{
.name = "RTOS",
.version = "0.0.0",
.paths = .{"."},
}
dimdin
December 8, 2024, 6:39pm
2
You must specify the branch after #
.
zig fetch --save git+https://github.com/epizzella/RTOS#zon
3 Likes
Sze
December 8, 2024, 6:41pm
3
I am not sure how to specify the branch with the git+https
protocol (in a way that is supported by the protocol).
However using https with a commit specific download url works as a workaround:
zig fetch --save https://github.com/epizzella/RTOS/archive/9d4801c309f5142848f124092034dd59a270e2f5.zip
2 Likes
fixer
December 8, 2024, 7:21pm
4
Thanks you both! Both ways are working for me. I didn’t realize that fetching a branch would be a little different from fetching master.
1 Like
pachde
December 9, 2024, 4:58am
5
master is fundamentally just another branch. It’s often designated the default branch, but doedn’t have to be. In modern github, it’s “main”, rather than “master”.
If you want stability, the fetch a commit rather than a branch.
Sze
December 9, 2024, 5:19am
6
When you use the git+https
protocol with zig fetch --save
it automatically adds the commit hash to the url, so you can use it with a branch and it creates a stable url from that.
1 Like