入手したリポジトリを自分のGitHubにpush
shallow でcloneする。
git clone --depth 1 https://github.com/tokyo-metropolitan-gov/covid19.git git config -l
自分のGitHubリポジトリにpushする。
GitHub上で「New repository」をクリックしてconvidを作成した。
cloneしたリポジトリのリポジトリurlを変更する。
git remote set-url origin https://github.com/txcdb738/convid19.git git remote -v origin https://github.com/txcdb738/covnid19.git (fetch) origin https://github.com/txcdb738/covnid19.git (push) git branch * development
pushする。
git branch -M main git push -u origin main
shallow update not allowedのエラーになった。
To https://github.com/txcdb738/convid19.git ! [remote rejected] main -> main (shallow update not allowed) error: failed to push some refs to 'https://github.com/txcdb738/convid19.git'
checkoutに--orphanをつけると、履歴が空のブランチ(orphan branch)が作成できる。
tmpという空のブランチを作ってコミットしてから、masterブランチをそれで置き換え、
別のRepositoryにpushすればよいみたい。
git checkout --orphan tmp git commit git checkout -B master git branch -d tmp git push origin master
これを参考にしました。
www.greptips.com