- 建立仓库
- 本地init
- git add.
- git commit -m ’ ’
- git push
报错
1. There is no tracking information for the current branch
#指定分支
git branch --set-upstream-to=origin/master master
#拉取
git pull
2. 指定分支时报错 fatal: Not a valid object name: 'master’
#创建分支时候报错
git branch master
Add one or more files to your directory, and git add them to prepare a commit. Then git commit to create your initial commit and master branch.
git init的时候没有指定分支,那么他就不会创建master分支,直到你进行了提交操作。
3. 可能自己只init 没有clone的时候,可以用这个代替clone的操作,我不太清楚
#关联本地与远程仓库
git remote add origin git的地址
4. fatal: refusing to merge unrelated histories
由于文件夹内有别的历史文件,git不允许融合,所以要加上–allow-unrelated-histories
git pull master --allow-unrelated-histories
5. 需要帮助的话
git branch -help
本文介绍了在尝试关联本地项目与git上的项目时遇到的常见错误及解决方案。包括:没有跟踪信息的报错,指定'master'分支失败,git init未创建master分支,未使用clone而直接init的情况,以及因文件夹存在不同历史记录导致的融合拒绝错误。了解这些错误可以帮助开发者顺利将本地项目推送到远程仓库。
8730

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



