如何通过git把本地项目传到github上

第一步:打开git.bash.exe,输入:cd 文件夹

第二步:git init(在当前目录中生成本地的git管理文件夹)

第三步:git add .(这个是将项目上所有的文件添加到仓库中的意思,如果想添加某个特定的文件,只需把.换

成这个特定的文件名即可

第四步:git commit -m "first commit"(对本次提交的注释,first commit可以换成你想写的)

第五步:git remote add origin github的项目地址( 将本地的仓库关联到github上

第六步:git push -u origin master(把代码上传到github仓库

第七步:输入账号和密码(会有弹出框提示)

注意:在第七步可能会出现的问题:! [rejected] master -> master (non-fast-forward)

解决方法:git pull --rebase origin master之后再进行第六步!!!

猜你喜欢

转载自blog.csdn.net/qq_27346075/article/details/80621289