第一次将本地映射到已经存在的仓库
https://techoverflow.net/2017/08/09/how-to-solve-git-fatal-no-configured-push-destination/
https://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories-on-rebase
//切换到本地的项目根目录下
git add .
git commit -m "first commit"
git remote add origin https://github.com/lkdghzh/go-ex.git//输入账号密码之后 git remote --verbose就可以看到 *master
git pull origin master --allow-unrelated-histories//加上--allow-unrelated-histories 避免fatal: refusing to merge unrelated histories
git push origin master
➜ webpack-4x-demo git:(master) ✗ git remote add origin https://github.com/lkdghzh/webpack-4x-demo.git
fatal: remote origin already exists.
https://stackoverflow.com/questions/10904339/github-fatal-remote-origin-already-exists
git remote rm origin
git remote add origin https://github.com/lkdghzh/go-ex.git
add commit push 用户名密码
删除远程多余的文件
例如 .idea的文件夹,以为第一次没添加到ignore而被提交上去了。现在想删除远程上的.idea
https://www.jianshu.com/p/de75a9e3d1e1
git rm -r -n --cached .idea //-n 列出想删的目录或者文件
rm '.idea/go-ex.iml'
rm '.idea/misc.xml'
rm '.idea/modules.xml'
rm '.idea/vcs.xml'
rm '.idea/workspace.xml'
git rm -r --cached .idea
rm '.idea/go-ex.iml'
rm '.idea/misc.xml'
rm '.idea/modules.xml'
rm '.idea/vcs.xml'
rm '.idea/workspace.xml'
git status
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .idea/go-ex.iml
deleted: .idea/misc.xml
deleted: .idea/modules.xml
deleted: .idea/vcs.xml
deleted: .idea/workspace.xml
git commit -m "git rm -r -n --cached .idea"
git push origin master