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 git@git.oschina.net: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 'git@gitee.com: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 //执行强制刷新

会提示更新成功,此时可以再码云查看是否上传成功

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值