代码上传码云

1.首先先创建码云的远程仓库,例下:(码云官网创建远程仓库的链接)

https://gitee.com/help/articles/4169

2.电脑安装git

git下载地址:
https://git-scm.com/downloads
安装完成后右键git base here打开控制台

3.配置用户姓名和邮箱

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

4.生成sskkey(三次回车即可生成sshkey )

"[email protected]"可改可不改

ssh-keygen -t rsa -C "[email protected]"

5.查看公钥

cat ~/.ssh/id_rsa.pub

在这里插入图片描述

6.克隆远程仓库的代码

git clone 远程仓库地址(https/ssh)

7.把要提交的代码文件夹放到.git一级,cd到要提交的代码文件夹里打开git

git add .
git commit -m "提交的内容提示"
git remote add origin 此处替换为远程仓库地址 //(此处若提示fatal: remote origin already exists)输入git remote -v查看是否为此次建立的远程仓库地址,如果是就不管,反之配置用户姓名和邮箱配置可能出错
git push // 默认master分支(第一种)
git push origin 指定远程仓库已有的分支 //(第二种)
//若提交不上去可以加-f强制提交,但是会覆盖远程仓库代码

猜你喜欢

转载自blog.csdn.net/weixin_49295874/article/details/115004550