本地项目提交到GitHub步骤:
首先要登录进入你的Github,点击New repository新建一个项目,然后在本地进行以下操作
1. git init //初始化仓库
2. git add .(文件name) //添加文件到本地仓库
3. git commit -m "first commit" //添加文件描述信息
4. git remote add origin + 远程仓库地址 //链接远程仓库,创建主分支
5. git pull origin master // 把本地仓库的变化连接到远程仓库主分支
6. git push -u origin master //把本地仓库的文件推送到远程仓库
即可将本地的项目push到github上。
如果报hint: Updates were rejected because the tip of your current branch is behind错误,则执行
1.git pull origin master --allow-unrelated-histories
2. git pull origin master
3.git push -u origin master
git常用命令:
删除文件:git rm -r .idea(path) git commit -m "delete file" git push
查看状态: git status
增加文件: git add .idea(path) git commit -m "add file" git push
idea上提交代码报Could not read from remote repository错误,可在Settings->Version Control->Git中,将SSH executable设置为Native即可
3156

被折叠的 条评论
为什么被折叠?



