git - 在 git 子模块中推送更改
问题描述
我在子模块 repo 中推送更改时遇到问题。
add submodule add https://github.com/ikalnytskyi/termcolor.git
git add .
git commit -m "Add the new color submodule"
之后,我对termcolor子模块进行了一些更改
cd termcolor
echo Hello>>hello.txt
git add .
git commit -m "Add hello.txt"
最后,我想将这个提交推送到我的远程仓库,但我认为 git 想要这个子模块仓库的登录名和密码,当然,我不知道。
git push origin master
Username for 'https://github.com': lyalival
Password for 'https://lyalival@github.com':
remote: Invalid username or password.
那么,问题来了,为什么 git 不把它推送到我的项目仓库呢?
PS 例如,在我的主文件夹中,我推送更改而不写登录名和密码,我只是输入
git push origin master
解决方案
最后我解决了。我认为 git 在我的存储库中添加了本地副本,但事实并非如此。
所以,如果我想更改子模块,我需要创建一个新项目,然后
cd submodule
git remote set-url origin [link_to_my_project]
然后我能够
git push origin master
推荐阅读
- sql - postgresql中的数据透视表
- html - 如何让 SceneView 地图显示在 div 容器中?
- nginx - nginx won't resolve hostname in K8S
- google-sheets - 将公式值返回到单元格并添加到谷歌表格中的现有数据
- php - Laravel 5.3 中的内存不足错误
- google-sheets - Google 表格通配符不适用于 COUNTIF
- python - mongoengine 和 mLab 与 Elastic Beanstalk 自动缩放
- javascript - 使用 JavaScript 模块
- java - spring 存储库 - 重复更新
- excel - 使用按钮在excel中的列之间切换数据