idea 使用git管理项目, window配置和第一次上传项目到码云

首先测试git是否安装成功 在cmd中输入命令

git --version

如果成功会出现版本信息

注册申请码云账户码云注册网址,新建远程服务项目仓储,获得ssh公匙复制留作备用。

首先初始化git

git init
查看提交到git上的文件,并查看是否提交成功,成功后git status为绿色。

git add .
git status
git commit -am "first commit project" //提交到git服务 -am 为全部提交 ,first commit project为第一次提交的备注

文件commit到本地git之后需要push到码云服务上执行

git remote add origin [email protected]:XXXXXXXXX//:加申请的公匙   连接到码云服务器端

连接后把把本地服务推动到远程

git push -u origin master
出现错误提示,提示需要git pull 更新服务上的代码
Enter passphrase for key '/c/Users/Thinkpad/.ssh/id_rsa':
To gitee.com:FangHuaShiJie/leaning_newmmall.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to '[email protected]:XXXXXXX/XXXXXXXXX.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
git pull
git push -u -f origin master //执行强制刷新
会提示更新成功,此时可以再码云查看是否上传成功


扫描二维码关注公众号,回复: 4509037 查看本文章

猜你喜欢

转载自blog.csdn.net/qq_35731738/article/details/79097650
今日推荐