Create a remote git repository within the LAN and push the local warehouse push to the remote repository
1. telnet to the server in the LAN first
2. switch to a folder in the server,
Then create a new folder to use as a git repository (the folder name is best with the same name as the warehouse folder that is being pushed to the server).
and switch to this folder,
The GIT init command will then be used to build a git repository under this folder (the-bare parameter in the figure is to create a bare repository),
Then quit the server.
3. After exiting the server, switch the local path to the root directory of the local repository,
If you do not have a repository locally, use the GIT init command to create a local repository, as shown in
Then use the "Git Remote Add origin ssh://server SSH user name @ server IP Address Server +git warehouse path" command to the remote repository, the server git repository path is the path outlined in the 2nd Green Line,
(The plus sign is removed from the "Server IP Address Server +git warehouse path" above.) If the server repository is a folder in Windows, such as d:/code/, the server SSH user is Admin,ip 192.168.1.100, then the command is git remote add Origin ssh://admin@192.168.1.100d :/code/)
If you are prompted to indicate that Origin already exists, that is, "fatal:remote origin already exists", use the GIT Remote RM Origin command to delete origin, delete and re-execute git remote add Origin to associate the remote repository.
4. Add the project file to the local index library with the git add–a command
Then submit the file with git commit–m "xxx" Command Index library
5. Next, use the command GIT push origin master to push to the master branch of the remote repository, as shown in the figure for Operation success
Here the direct push push on the server warehouse, do not use pull pulls, or will error, the report can not find the master branch, because the server warehouse is empty, so there will be no branch
6. You can test whether the success
git remote show origin
Delete local repository and clone once to local
OK, Finish ~
The END