Publish the new project to github

1. git init in the project directory
2、git add .
3、git commit
4. Create a github library with the name: platform, and get the library address: https://github.com/gosenkle/platform.git
At this time, the protocol and other information are selected as none, and the entire project is kept empty, otherwise it cannot be uploaded from the local library.
5. Associated library address
git remote add origin https://github.com/gosenkle/platform.git
6. Push to github
git push -u origin master
-u: Since the content is empty during initialization, the -u parameter is required; it can be omitted later
7. If the remote library is not an empty library due to the establishment of information such as readme and protocol when building the github library, the following error will occur when executing 6
error: failed to push some refs to https://github.com/gosenkle/platform.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
如果此时执行git pull origin master会发生如下错误
fatal: refusing to merge unrelated histories
8、执行如下命令git pull origin master --allow-unrelated-histories,成功,后续可以执行6操作了。

9、创建本地分支并同步到远程库
1)本地执行git branch release
2)切换分支 git checkout release
3)将分支放到远程库:git push origin release


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324649602&siteId=291194637