The article is from copy. But it didn't work out. After the 5th step, I add the content. It's my pleasure to help you.
Preparatory work:
Create a new project in Github/gitlab audit
1. Initialize the local repository in the local directory zhunions directory
Git init
2. Create a. Gitignore readme.md file
3. Local Submissions
git Add.
Git commit-m "First commit"
4. Add a remote association
Git remote add Origin git@172.16.10.9:namespace/zhunions.git
5. The local branch is associated with the remote branch and pushed to the remote repository
git push--set-upstream Origin Master
The 5 steps above can be used to correlate local warehouses and branches with remote warehouses and branches.
If a git pull appears
Fatal:refusing to merge unrelated histories
Perform
Git pull Origin branchname--allow-unrelated-histories
Branchname Change to Master
The local master and the remote master have already established a connection.
Next switch to Dev
$ git branch-a
* Master
remotes/origin/dev
Remotes/origin/master
Not to be continued
After performing all operations, the following results are available:
A. Generating a local branch master
B. Remote warehouse associated with a local warehouse origin
C. Remote Branch master associated with a local branch
D. The local code is all submitted to the remote repository and others can share the