Repository navigation
Description
Hi!
I'm currently working on a small and simple tool for syncing my forks utilizing this library which can be found here: https://github.com/topikettunen/gitsyncr. The tool simply just pulls the latest changes from upstream and then pushes them to my fork.
I stumbled upon this problem when I was trying to push the latest changes from the Linux kernel's upstream to my fork using my tool which then resulted in the following output: https://github.com/topikettunen/gitsyncr/issues/1.
Code in question is:
func pushChanges(url, path string, user user, publicKey *ssh.PublicKeys) {
r, err := git.PlainOpen(path)
if err != nil {
log.Fatal(err)
}
pushOpts := pushOpts(url, user, publicKey)
err = r.Push(&pushOpts)
if err == git.NoErrAlreadyUpToDate {
log.Printf("%s already up to date...\n", url)
} else if err != nil {
log.Fatal(err)
}
}PushOptions used:
if strings.Contains(url, "git://") {
pushOpts = git.PushOptions{
RemoteName: "fork",
Progress: os.Stdout,
}
} else {
pushOpts = git.PushOptions{
RemoteName: "fork",
Auth: publicKey,
Progress: os.Stdout,
}
}The function didn't seem to have any problems when pushing changes for other my forks, e.g. Kubernetes which is also a quite large repository. But this error arises only with this Linux kernel fork. I was thinking could it be something related to different protocols used, since I used Git protocol for the kernel's upstream and SSH to push to the fork, but after testing with the Linux's GitHub mirror which uses SSH, it resulted in the same error. Although cloning and pulling from the upstream worked for the Linux kernel, only the push failed. This then led me to believe this is something related to large repositories.
Am I doing something wrong or do you know the answer to this?
Activity
mcuadros commentedon Apr 23, 2020
Without reading you project is hard to tell, but assuming is correct since is able to push to another repository, maybe is a bug.
As always a
EOFis hard to tell, maybe it's from the upstream connection maybe it's reading your files. :/topikettunen commentedon Apr 23, 2020
Yeah, I haven't encountered problems with other repositories.
Also running Git alone, e.g.
git pull upstream master && git push fork master, works fine on this repository, but something happens within this library between the pull and push.github-actions commentedon Sep 29, 2023
To help us keep things tidy and focus on the active tasks, we've introduced a stale bot to spot issues/PRs that haven't had any activity in a while.
This particular issue hasn't had any updates or activity in the past 90 days, so it's been labeled as 'stale'. If it remains inactive for the next 30 days, it'll be automatically closed.
We understand everyone's busy, but if this issue is still important to you, please feel free to add a comment or make an update to keep it active.
Thanks for your understanding and cooperation!
st3fan commentedon Jun 17, 2024
This issue happens for me with the following trace .. i'm pushing a rather large change set over SSH. I'm specifically having this problem with AWS CodeCommit. The same push to another Git hosting service works fine. I'm thinking AWS is less lenient about long running operations that keep the connection idle with no traffic.
The
io.Copy()returns the EOF which makes me think the underlying SSH channel has been closed.Full trace:
st3fan commentedon Jun 17, 2024
@mcuadros is it possible to re-open this issue? i can provide more details if you have specific questions.
st3fan commentedon Jun 17, 2024
From https://github.com/git/git/blob/master/Documentation/config/uploadpack.txt
This sounds like a plausible underlying root cause.
pjbgf commentedon Jun 17, 2024
@st3fan thanks for looking into it, and at a quick glance it does sound like a plausible root cause. It would be good to understand what that "empty keepalive packet" looks like upstream, and then make that option available potentially via PushOptions.
Another thing to look at is whether there is any capability that controls such behaviour, so that the server can opt-out of this or is this solely managed by the client side?
ostapkonst commentedon Mar 13, 2025
We encountered a similar issue when pushing changes to a large repository over the SSH protocol. Conducted a small investigation... It appears that the problem arises because a significant amount of time passes between opening the session (newSendPackSession) and actually sending the hash packets (pushHashes), during which the connection manages to close. As the @st3fan above mentioned, in the second version of the Git protocol, the connection is maintained by sending additional packets (
0005\1, in git src). For the first version of the protocol, I suggest using two connections instead of one as a draft solution.Below is a patch that resolves the issue we encountered in our case: