【github使用】创建项目后上传到github

本地创建项目,同步到github,有两种方法:

(1)github上创建resp,clone到本地,该仓库作为项目,即可push和pull。

(2)本地创建项目,github上创建同名仓库,git remote add,git push -u,即可push和pull。

最近使用xcode,创建新仓库clone到本地,用xcode打开后,创建file只能创建file,无法选择template。第一种方法行不通,采用第二种方法。

进行push:git push --set-upstream origin maste,报错如下:

本地缺少远程仓库的一些work,需要pull一下。

那就pull一下:

git pull --rebase origin master

再push一下:

git push -u origin master

或者git push --set-upstream origin master

done.

 

 

参考资料:

《git官方手册》https://git-scm.com/docs/git-push

《本地初始化项目推送到github》https://blog.csdn.net/u011141492/article/details/89970189

《git push常见错误》https://blog.csdn.net/wangwangwanglichao/article/details/79983262

《git使用 将本地项目上传到github》 https://www.cnblogs.com/du-hong/p/9921214.html