reactjs - 将本地存储库添加到 github 存储库中的文件夹
问题描述
背景 我目前正在制作很多反应应用程序。为了将它们全部放在一个存储库中,以免它们与 Python 和其他项目混合,我想将所有项目放入一个 Github 存储库中。
在那个存储库中,我有诸如“stock-tracker”之类的文件夹,我想使用 Git Bash 将我的存储库推送到该文件。
如果我使用git remote set-url origin https://github.com/leonkuessner/React/stock-tracker.git
, 然后git push origin main
,我得到错误:
remote: Not Found fatal: repository 'https://github.com/leonkuessner/React/stock-tracker.git/' not found
问题 如何将本地存储库添加到 Github 存储库中的文件夹
我对 Github 和 Git 都还很陌生,所以如果我解释得不够充分,请在评论中告诉我,我会尽力澄清!
解决方案
- 你需要克隆回购
- 在这个 repo 中添加远程到你想要插入 repo 的本地文件夹
- 使用 --allow-unrelated-histories 标志从此远程拉到您的原始分支
git remote add another-source ../../some/source
git pull another-source master --allow-unrelated-histories
推荐阅读
- sql - 我是 codeigniter 的新手:如何将此 SQL 转换为 codeigniter 模型
- excel - 如何创建折线图?
- php - ini_set('memory_limit', '512M') - 语法错误 - 意外的“M”?
- gradle - Gradle中“def”和“static def”的区别
- javascript - OnClick show one image, onClick show other image
- python - 无法多次使用 astropy 打开远程 FITS
- reactjs - How to override the transition of drawer?
- vue.js - 如何更改 vuetify 中的文本字段布局?
- mongodb - MongoDB:从日期中减去月份,并从数据库中获取值
- ruby - 在 Ruby 中启动子进程并继续执行脚本