First create a remote repository and push to a remote repository local project

First create a remote repository and push to a remote repository local project

step

Administrator created in remote repository, with the remote address of the warehouse, but no code.

Build a project in the local

Initialization warehouse in the project, and commit

Adding a remote repository, locally

The native code pushed to the remote repository

Initialization warehouse in the project, and commit

1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization
$ git init
Initialized empty Git repository in C:/Users/1/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization/.git/

Adding a remote repository

1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
$ git remote add origin [email protected]:devops/teach_organization.git
1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
$ git remote -v
origin  [email protected]:devops/teach_organization.git (fetch)
origin  [email protected]:devops/teach_organization.git (push)

The native code pushed to the remote repository

1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
$ git push origin master
Enumerating objects: 45, done.
Counting objects: 100% (45/45), done.
Delta compression using up to 6 threads
Compressing objects: 100% (26/26), done.
Writing objects: 100% (45/45), 54.74 KiB | 4.98 MiB/s, done.
Total 45 (delta 1), reused 0 (delta 0)
To 192.168.1.254:devops/teach_organization.git
 * [new branch]      master -> master

All branches

1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
$ git branch -a
* master
  remotes/origin/master

bugs

If the local git repository did not commit, you can not see the branch, can not be pushed to the remote repository.

1@DESKTOP-3H9092J MINGW64 ~/Documents/WeChat Files/jiezzdota/FileStorage/File/2019-11/teach_organization (master)
$ git log
fatal: your current branch 'master' does not have any commits yet

Guess you like

Origin www.cnblogs.com/mozq/p/11796220.html