git 本地项目上传到码云

如果你的本机是安装成功第一次使用,先配置一下一些基本的信息

1git config–global user.name “Your Name”
2 git config --global user.email"[email protected]"

一、在码云上创建项目名称为demo的项目
二、打开GitBash ,用cd命令进入本地项目目,然后把初始化一下,把本地的目录变成git本地仓库, git status 可以查看本地目录的状态信息

1git init
2git status

三、将你本地仓库与码云上的远程仓库关联起来

1git remote add origin https://gitee.com/xxxxx/demo.git

四、在你准备上传你的项目之前,最好更新一下项目,确保没有和远程仓库的代码有冲突

git pull --rebase origin master

五、把你的项目复制到这个目录下,用命令添加你要上传的项目,再提交到本地暂存区,最后把本地仓库项目提交到远程仓库。git 是强烈建议你在提交代码的时候,要写备注注释的,所以既然人家是强烈建议,你就别懒了。

1git add . 添加目录下所有发生改变的文件
2git commit -m ‘注释信息’
3 git push -u origin master 本地仓库代码提交至远程仓库

六、新建一个目录,从码云上把上传的代码下载下来:

git clone https://gitee.com/xxxxx/demo.git

备注:git remote add origin https://gitee.com/fengkaiyan/snake_game_h5
fatal: remote origin already exists.
使用:git remote rm origin

链接:http://www.cnblogs.com/qhorse/p/9599794.html

猜你喜欢

转载自blog.csdn.net/qq_39039128/article/details/84201397