【Python】一键git脚本
2020-04-27 07:19
239 查看
使用git bash上传仓库是比较繁琐的,此脚本可以一键将你写好的项目上传到github
配置git环境变量
以下为windows配置方法
找到git的安装路径,将以下路径添加到环境变量
磁盘名称:\...\Git 磁盘名称:\...\Git\mingw64\libexec\git-core 磁盘名称:\...\Git\mingw64\bin
检验是否配置完毕
cmd输入
python import os os.system('git')
若出现上图所示情况,代表配置成功
PS:
1:请在cmd或powershell中输入命令,在Python的原生shell中会只返回1
一键git脚本模块
main.py
可能以后会有更新
import os import time __AUTHOR__ == 'Catci' def updata(description=None,gitsite=None): os.system('git init') os.system('git add .') os.system('git status') description = input('please input your Repositories description:\n') os.system('git commit -m' + description) gitsite = input('please input your Repositories website:\n') if gitsite[:19] =='https://github.com/' print('website is no wrong') os.system('git remote add origin' + gitsite) os.system('git push origin master') list_ = [i for os.popen(command).readlines() in os.popen(command)] if list_[2][:5} == 'error' os.system('git pull origin master') os.system('git pull origin master') print('updata successfully') else: print('updata successfully') else: print('your gitsite is wrong,please check it!\nthe right site is https://github.com/....') time.sleep(3) if __name__ == '__main__': updata()
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- Python之打包一键自动化脚本(针对cmt设备)
- 一键更新目录下所有git repo的脚本
- python脚本之一键移动自定格式文件方法实例
- python 一键添加 zabbix 监控脚本 推荐
- [开源] android apk 一键生成混淆文件 脚本分享 (python)
- 用python写个一键锁屏的小脚本
- CentOS6一键升级Python2.7及安装常用工具脚本
- maven,git python脚本 自动化 部署 spring boot进销存系统
- python 用于git的脚本
- shell命令行,一键创建 python 模板文件脚本方法
- python脚本通过Jenkins自动化部署git服务器中的web网站
- python pdf一键翻译脚本
- Linux下Notepadqq配置Python脚本一键运行命令
- shell命令行,一键创建 python 模板文件脚本方法
- python脚本实现git commit hooks钩子
- 一键升级python至2.6.5的脚本
- python脚本一键抓考试资料网答案
- Python一键添加Zabbix监控脚本
- 一键安装nginx,keepalived,python脚本
- Python脚本:一键打开上次Maya崩溃后所保存的临时文件