1. 初始化Git
首先在github上创建一个repository,修改默认的default branch 为master 后续用main会有问题。
然后使用终端git(windows10)或者linux 终端。
执行以下操作:
# 1. cd your uploaded dir
git init
# 2. add ignore-file
touch .gitignore
# 3. add
git add -A
# 4. upload local repository
git commit -m 'first commit'
# 5. git remote add origin
git remote add origin https://xx.git
# 6. git push -u origin local_branch:github_branch
git push -u origin master # means `master` is the name of local branch and github branch .
git push -u origin master:main
# 更新后 需要用户名 以及token
# 7. git pull origin github_branch:local_branch
git pull origin master
git push original master:master # 注意这是个坑,pull能够更新本地的条件是,你在github上的文件更改了,而不是本地的文件更改,想用github上传的同个文件的内容更改回来,这样子是不行的,但是不会报错。
# 7. git branch -A
* master # color view by green is the local branch
remotes/origin/master is the
8. git status
2 . 使用VS Code
如果提示,没有找到Git,