本机若是安装成功第一次使用,先配置一下一些基本的信息
git config --global user.name "Your Name"
git config --global user.email"email@example.com"
安装Git 创建远程仓库



在文件目录右键点击 Git Bash here

git init

git remote add origin https://gitee.com/qiuang/vueJs.git

git pull --rebase origin master

git add .

git commit -m 'Initial commit'

git push -u origin master


! [rejected] master -> master (non-fast-forward) error: failed to push some refs to解决方法
在网上搜了好久,输入了各种无效和错误的命令后,终于找到了解决办法:
1、git pull origin master --allow-unrelated-histories //把远程仓库和本地同步,消除差异

2、重新add和commit相应文件

3、git push -u origin master

4、此时就能够上传成功了

下载项目
新建一个目录,从码云上把上传的代码下载下来:
git clone https://gitee.com/xxxxx.git
倘若报:remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/qiguang0120/java-mythology.git/'
首先用登录GitHub网站做如下设置



生成了一个新的token
然后再用命令行输入命令
git push -u origin master
输入用户名密码.ok
此外:
git分支从master切换到main