上传项目到github仓库

1、首先建立本地的git文件夹

第一步:建立git仓库

cd到你的本地项目根目录下,执行git命令

第二步:将项目的所有文件添加到仓库中

git add .

如果想添加某个特定的文件,只需把.换成特定的文件名即可

第三步:将add的文件commit到仓库

git commit -m "注释语句"

第四步:去github上创建自己的Repository,创建页面如下图所示:

拷贝仓库地址,形式如下:

https://github.com/github_username/project_name

第五步:重点来了,将本地的仓库关联到github上

git remote add origin https://github.com/hanhailong/CustomRatingBar

第六步:上传github之前,要先pull一下,执行如下命令:

git pull origin master(做不了就算了,可以接着下一步)

第七步,也就是最后一步,上传代码到github远程仓库

git push -u origin master

如出现如下提示:

to set your account's default identity.

Omit --global to set the identity only in this repository.

需设置git的用户名和地址:

git config --global user.name "XXX"

git config --global user.email "XXX"

猜你喜欢

转载自blog.csdn.net/zzyy0929/article/details/79304320