无法在批处理脚本中提交到现有的github存储库

问题描述

我制作了以下批处理脚本,以自动运行程序并将CSV文件提交到我的存储库。通行证填有我的真实密码。我删除了现有的本地存储库,以便每次clone命令都能获取最新的干净版本。每当运行此命令时,我都会得到:

! [拒绝]主站->主站(非快进)错误:失败 推一些参考 'https://github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment.git' 提示:由于当前分支的提示是 背后的提示:它的远程对应。整合远程变更 (例如,提示:“ git pull ...”),然后再次推送。提示:请参阅“注意 有关快速转发的详细信息,请参见'git push --help'。

pip

有人可以告诉我如何实际执行此操作吗?我已经在网上搜索了大量内容,并尝试了一些无效的内容。 预先感谢。

解决方法

我解决了这个问题。以下脚本将对此起作用:

:: @echo off
call C:\Users\maxbear123\anaconda3\Scripts\activate.bat
call conda activate Scraper
call cd C:\Users\maxbear123\Documents\Python_Scripts\Knox-County-Covid-19-Risk-Assesment
call git init 
call git pull https://maxbear123:pass@github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment
call python COVID-19_School_Risk_Data_Logger.py
call git add historical_predictions.csv
call git commit -m"Automated Prediction Update"
call git push https://maxbear123:pass@github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment.git

从本质上讲,我从根本上不了解git的工作原理。

对于其他具有类似无知的人,此过程如下:

要开始提交到现有存储库,请执行以下操作:

  1. 克隆https:// user:password@github.com/user/repo
  2. cd进入克隆的存储库(现在是计算机上的目录)
  3. init
  4. 编辑或添加文件
  5. 添加那些添加/编辑的文件
  6. 提交-m“消息”
  7. 按下https:// user:password@github.com/user/repo

要继续提交到现有存储库,请执行以下操作:

  1. cd到以前克隆的存储库(计算机上的目录)
  2. init
  3. 拉动https:// user:password@github.com/user/repo
  4. 编辑或添加文件
  5. 添加那些添加/编辑的文件
  6. 提交-m“消息”
  7. 按下https:// user:password@github.com/user/repo

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...