无法在批处理脚本中提交到现有 github 存储库
Can't commit to an existing github repository in a batch script
我已经制作了以下批处理脚本来自动 运行 一个程序并将一个 csv 文件提交到我的存储库。通行证填写的是我的真实密码。我删除了现有的本地存储库,以便克隆命令每次都能获得最新的干净版本。每当我 运行 这个,我得到:
! [rejected] master -> master (non-fast-forward) error: failed
to push some refs to
'https://github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment.git'
hint: Updates were rejected because the tip of your current branch is
behind hint: its remote counterpart. Integrate the remote changes
(e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note
about fast-forwards' in 'git push --help' for details.
:: @echo off
call C:\Users\maxbear123\anaconda3\Scripts\activate.bat
call conda activate Scraper
call cd C:\Users\maxbear123\Documents\Python_Scripts
call python COVID-19_School_Risk_Data_Logger.py
call del Knox-County-Covid-19-Risk-Assesment /Q
call git clone https://maxbear123:pass@github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment
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
cmd /k
有人能告诉我具体怎么做吗?我在网上搜索了很多,并尝试了一堆没有用的东西。
提前致谢。
我解决了这个问题。以下脚本适用于此:
:: @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 是如何工作的。
对于其他具有类似无知的人来说,这是过程:
开始提交到现有存储库:
- 克隆 https://user:password@github.com/user/repo
- cd 进入克隆的 repo(现在是您计算机上的一个目录)
- 初始化
- 编辑或添加文件
- 添加 added/edited 个文件
- commit -m”消息”
- push https://user:password@github.com/user/repo
要继续提交到现有存储库:
- cd 进入之前克隆的 repo(您计算机上的一个目录)
- 初始化
- pull https://user:password@github.com/user/repo
- 编辑或添加文件
- 添加 added/edited 个文件
- commit -m”消息”
- push https://user:password@github.com/user/repo
我已经制作了以下批处理脚本来自动 运行 一个程序并将一个 csv 文件提交到我的存储库。通行证填写的是我的真实密码。我删除了现有的本地存储库,以便克隆命令每次都能获得最新的干净版本。每当我 运行 这个,我得到:
! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
:: @echo off
call C:\Users\maxbear123\anaconda3\Scripts\activate.bat
call conda activate Scraper
call cd C:\Users\maxbear123\Documents\Python_Scripts
call python COVID-19_School_Risk_Data_Logger.py
call del Knox-County-Covid-19-Risk-Assesment /Q
call git clone https://maxbear123:pass@github.com/maxbear123/Knox-County-Covid-19-Risk-Assesment
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
cmd /k
有人能告诉我具体怎么做吗?我在网上搜索了很多,并尝试了一堆没有用的东西。 提前致谢。
我解决了这个问题。以下脚本适用于此:
:: @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 是如何工作的。
对于其他具有类似无知的人来说,这是过程:开始提交到现有存储库:
- 克隆 https://user:password@github.com/user/repo
- cd 进入克隆的 repo(现在是您计算机上的一个目录)
- 初始化
- 编辑或添加文件
- 添加 added/edited 个文件
- commit -m”消息”
- push https://user:password@github.com/user/repo
要继续提交到现有存储库:
- cd 进入之前克隆的 repo(您计算机上的一个目录)
- 初始化
- pull https://user:password@github.com/user/repo
- 编辑或添加文件
- 添加 added/edited 个文件
- commit -m”消息”
- push https://user:password@github.com/user/repo