强制覆盖本地代码
# 强制覆盖本地代码
git fetch --all
git reset --hard origin/master
git pull
修改git邮箱和用户名
git config --global user.name "tietiejiang" #修改名称
git config --global user.email "你的邮箱" #修改邮箱
上传到git的命令
git init #在虚拟环境当前目录生成git的存储空间
git add . #把项目中的文件放到存储空间
git commit -m '第一次提交' # 提交
git push https://gitee.com/tietiejiang/renwuguanli.git master #master 是分支的意思
git remote add origin https://gitee.com/tietiejiang/renwuguanli.git #另外一种方法,给这个仓库地址增加一个别名
git push origin master #正式提交到远程仓库
关于ssh的一些用法
git clone git@gitee.com:tietiejiang/renwuguanli.git #ssh方式下载的命令
#从远程仓库中下载代码到本地 需要在命令行执行 先cd到想下载的地址。笔记本电脑有BUG 只能使用ssh方式
git clone https://gitee.com/tietiejiang/renwuguanli.git
#ssh 方式需要生成密钥 C:\Users\longg\.ssh 在这个文件夹 右键 GitBach here 进入 MINGW64 输入命令
ssh-keygen #回车回车回车就成功了 .ssh 中有两个文件 id_rsa 为私钥 id_rsa.pub 为公钥上传至gitee
.gitignore 的设置(不让git上传到远程仓库)
# pycharm 文件名:.gitignore 放在最外面
.idea/
.DS_Store
__pycache__/
*.py[cod]
*$py.class
# Django stuff:
local_settings.py
*.sqlite3
# database migrations
*/migrations/*.py
!*/migrations/__init__.py