この記事を作った動機
単にすでに存在する、git リポジトリを LAN 内の Gitea 上にアップロードするための方法の簡易的なメモ。Githubの場合でも同じようなことはできると思う。(そもそも github のページ参考にしたし)
やり方
リポジトリの URL は、“https://aaa.info/urlToAremoteRepo.git" と仮定している。
リポジトリの作成(リモート側)
リモート側に、最小構成で、readme や license、gitignore を追加しないようにして空っぽのリポジトリを作成する。
リポジトリの URL を設定する(ローカル側)
git remote add origin https://aaa.info/urlToAremoteRepo.git
ブランチの確認(ローカル側)
アップロードしたいブランチの確認。今回は “master” という名前のブランチを、リモートにアップロードする。
git branch
* master
アップロード(ローカル側)
git push origin master
リポジトリが設定できたかの確認方法
git remote -v
origin https://aaa.info/urlToAremoteRepo.git (fetch)
origin https://aaa.info/urlToAremoteRepo.git (push)
参考にしたサイトとか
- Adding locally hosted code to GitHub - GitHub Docs
https://docs.github.com/en/migrations/importing-source-code/using-the-command-line-to-import-source-code/adding-locally-hosted-code-to-github (2025年5月19日)