梯子设置全局代理, 修改http代理不知道是否是生效原因,参见https://blog.hyperzsb.tech/git-ssl-error/
将repo地址设置为git remote set-url origin https://<your_token>@github.com/<USERNAME>/<REPO>.git
,如果在vscode上可进行认证,则不需要更改remote.
参见https://blog.csdn.net/weixin_41010198/article/details/119698015
- 在vscode中初始化repo, 记得
git init
- github创建私仓
- 关联repo和github
git remote add origin ....
git add .
git commit -m 'init push'
git push -u origin master
- 在overleaf中import from github
进入项目所在文件夹,然后输入
git config --global user.name [username]
git config --global user.email [email]
git config --global credential.helper store
Ctrl+X
git rm -r --cached .
git add .
git commit -m 'add .gitignore'
更多关于.gitignore的操作:https://www.cnblogs.com/kevingrace/p/5690241.html
git pull origin master
dir
git rm -r --cached <folder_name or file_name>
git commit -m 'delete <folder_name or file_name>'
git push -u origin master
git status # 查看modified file
git reset HEAD # 上一次add全部撤销
git reset HEAD ./test.py # 仅撤销单个文件
git reset --soft HEAD^
# 下载远程库最新内容,不作合并
git fetch --all
# 把HEAD指向最新的master版本
git reset --hard origin/master
git pull
error: Your local changes to the following files would be overwritten by merge: xxx.py Please, commit your changes or stash them before you can merge.
先用stash保存
git stash
git pull
git stash pop
在pop步一般会出错,如
Auto-merging main.py
CONFLICT (content): Merge conflict in xxx.py
方案:
git status #查看出问题的地方
通过vim修改代码,最后
git add .