新项目上传文件方法
1.首先创建一个项目
点击Create repository
后就会得到一个新建项目的地址,复制好这个地址,之后会用到.
下载git bash工具:https://git-scm.com/downloads,下载完成后右击打开你想上传的项目
2.上传方法
如果是刚建的新仓库:
echo "# XY Cross-domain" >> README.md #引号里是你想添加的内容
git init
git add README.md
git commit -m "描述内容"
git branch -M main
git remote add origin https://github.com/isxiangyang/XY_Cross-domain.git #这里改成你的项目地址
git push -u origin main
3.更新方法
git add ./
git status
git commit -m "描述内容"
git remote set-url origin https://github.com/isxiangyang/XY_Cross-domain.git
git branch -M main
git push -u origin main #这里的main代表的是github的主分支,我这边默认是main
报错信息
fatal: remote origin already exists.
解决方法:
git remote rm origin
penSSL SSL_read: Connection was reset, errno 10054
解决方法
git config --global http.sslVerify "false"
ailed to connect to github.com port 443 after 21076 ms: Timed out
解决方法:
git config --global --unset http.proxy
gitlab操作例子
git init
git add .
git commit -m "test"
git remote add origin https://gitlab.intra.xxxx.com/username/tool.git
git pull --rebase origin master (这一步是为了解决error: failed to push some refs to)
git push -u origin master
git remote remove origin