首先,记录一下mac系统显示隐藏文件夹的快捷键:command+shift+句号,可以显示工程目录下的隐藏的git文件夹
找到工程目录下的.git/config文件发现里边没有remote origin的配置,手动填上去,如下:
- [core]
- repositoryformatversion = 0
- filemode = false
- bare = false
- logallrefupdates = true
- symlinks = false
- ignorecase = true
- [remote "origin"]
- url = 远程仓库地址
- fetch = +refs/heads/*:refs/remotes/origin/*
- [branch "master"]
- remote = origin
- merge = refs/heads/master
-
检查remote内容
git remote -v
删除远程origin
git remote rm origin
检查是否完全删除
git remote -v
重新建立连接
git remote add origin 远程仓库的地址
- git merge master --allow-unrelated-histories
- git pull --allow-unrelated-histories
- git push origin master