git本地推送远程
第一次将本地映射到已经存在的仓库
https://techoverflow.net/2017/08/09/how-to-solve-git-fatal-no-configured-push-destination/
https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase
//切换到本地的项目根目录下
git add .
git commit -m "first commit"
git remote add origin https://github.com/lkdghzh/go-ex.git//输入账号密码之后 git remote --verbose就可以看到 *master
git pull origin master --allow-unrelated-histories//加上--allow-unrelated-histories 避免fatal: refusing to merge unrelated histories
git push origin master
➜ webpack-4x-demo git:(master) ✗ git remote add origin https://github.com/lkdghzh/webpack-4x-demo.git
fatal: remote origin already exists.
https://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists
git remote rm origin
git remote add origin https://github.com/lkdghzh/go-ex.git
add commit push 用户名密码
删除远程多余的文件
例如 .idea的文件夹,以为第一次没添加到ignore而被提交上去了。现在想删除远程上的.idea
https://www.jianshu.com/p/de75a9e3d1e1
git rm -r -n --cached .idea //-n 列出想删的目录或者文件
rm '.idea/go-ex.iml'
rm '.idea/misc.xml'
rm '.idea/modules.xml'
rm '.idea/vcs.xml'
rm '.idea/workspace.xml'
git rm -r --cached .idea
rm '.idea/go-ex.iml'
rm '.idea/misc.xml'
rm '.idea/modules.xml'
rm '.idea/vcs.xml'
rm '.idea/workspace.xml'
git status
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .idea/go-ex.iml
deleted: .idea/misc.xml
deleted: .idea/modules.xml
deleted: .idea/vcs.xml
deleted: .idea/workspace.xml
git commit -m "git rm -r -n --cached .idea"
git push origin master
知识没有高低贵贱之分。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· DeepSeek如何颠覆传统软件测试?测试工程师会被淘汰吗?