Repeated pushes from a mirrored clone deletes HEAD
- Dominant language
- Go
- Stars
- 9.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
Keybase version: `Version 5.2.0-20200130011203+cf82db8320 (5.2.0-20200130011203+cf82db8320)`
MacOS Catalina 10.15.3
git version 2.25.0
keybase log id: bf8317f6c36a1094efe2941c
I have a handful of repos on github that I want to mirror in keybase.
### 1. Pushing to keybase via URL
Initial setup works as desired:
```
$ git clone --mirror git@github.com:jasonkarns/repo.git
Cloning into bare repository 'repo.git'...
remote: Enumerating objects: 236, done.
remote: Counting objects: 100% (236/236), done.
remote: Compressing objects: 100% (123/123), done.
remote: Total 236 (delta 89), reused 234 (delta 87), pack-reused 0
Receiving objects: 100% (236/236), 613.98 KiB | 2.84 MiB/s, done.
Resolving deltas: 100% (89/89), done.
$ cd repo.git
$ git push --mirror keybase://private/jasonkarns/repo
Initializing Keybase... done.
Syncing with Keybase... done.
Syncing encrypted data to Keybase: (100.00%) 5.97/5.97 KB... done.
Counting objects: 621.48 KB... done.
Preparing and encrypting objects: (100.00%) 621.48/621.48 KB... done.
Counting refs: done.
Preparing and encrypting refs: done.
Counting packed refs: 305 bytes... done.
Preparing and encrypting packed refs: (100.00%) 305/305 bytes... done.
To keybase://private/jasonkarns/tempy
* [new branch] master -> master
* [new tag] v1.0.0 -> v1.0.0
* [new tag] v2.0.0 -> v2.0.0
```
But running the same push command a second time deletes HEAD from the keybase remote.
```
$ git push --mirror keybase://private/jasonkarns/repo
Initializing Keybase... done.
Syncing with Keybase... done.
To keybase://private/jasonkarns/repo
- [deleted] HEAD
```
### 2. Pushing to keybase via named remote
Also, setting up the clone with a named remote for keybase works fine on the initial push:
```
$ git clone --mirror git@github.com:jasonkarns/repo.git
Cloning into bare repository 'repo.git'...
remote: Enumerating objects: 236, done.
remote: Counting objects: 100% (236/236), done.
remote: Compressing objects: 100% (123/123), done.
remote: Total 236 (delta 89), reused 234 (delta 87), pack-reused 0
Receiving objects: 100% (236/236), 613.98 KiB | 2.84 MiB/s, done.
Resolving deltas: 100% (89/89), done.
$ cd repo.git
$ git remote add --mirror=push keybase keybase://private/jasonkarns/repo
$ git push keybase
Initializing Keybase... done.
Syncing with Keybase... done.
Syncing encrypted data to Keybase: (100.00%) 5.97/5.97 KB... done.
Counting objects: 621.48 KB... done.
Preparing and encrypting objects: (100.00%) 621.48/621.48 KB... done.
Counting refs: done.
Preparing and encrypting refs: done.
Counting packed refs: 305 bytes... done.
Preparing and encrypting packed refs: (100.00%) 305/305 bytes... done.
To keybase://private/jasonkarns/repo
* [new branch] master -> master
* [new tag] v1.0.0 -> v1.0.0
* [new tag] v2.0.0 -> v2.0.0
```
But yet again, any _subsequent_ push deletes `HEAD`.
```
$ git push keybase
Initializing Keybase... done.
Syncing with Keybase... done.
To keybase://private/jasonkarns/repo
- [deleted] HEAD
```
In both cases, after getting the "deleted HEAD" message, the Keybase app then shows "This folder is empty." when viewing files for that repo.
This issue does _not_ manifest when pushing from a non-mirror clone.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the second push with the documented git clone --mirror and git push --mirror commands, then trace the Keybase remote handling for mirrored repositories. Done means repeated mirror pushes no longer delete HEAD or make the repository appear empty, while pushes from a non-mirror clone remain unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, go
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100