Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add a local project to a remote git repository

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces "how to add the local project to the remote git warehouse". In the daily operation, I believe that many people have doubts about how to add the local project to the remote git warehouse. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to add the local project to the remote git warehouse". Next, please follow the editor to study!

There are two methods: this article focuses on the second.

Method 1:

Create an empty remote git repository; pull to an empty local directory, and the local empty directory automatically becomes a local repository associated with the remote git repository; copy your project files to the empty directory created in the previous step; add the files to git and submit. Got it.

Method 2:

Step 1: create a remote git repository.

Now there are a variety of git repositories available on the network, and everyone is free to choose; if you have conditions, you can also build a git server on your own server. I will not repeat it here.

Step 2: create a local project

Create your own project, and the tool's own work type is created at will.

Step 3: step 3, set up a cost warehouse for the directory where the local project is located.

Go to the directory where the project is located, and right-click git bash

Open the console of git and enter the command git init

At this point, the local project directory has become a local warehouse

Step 4: add the project files to the local warehouse

Git add. Please note that there is a dot behind the add

Step 5, submit the added files to the local warehouse

Git commit-m 'first add code'-m is followed by the log of this submission

Step 6, add a remote warehouse address

Git remote add origin http://xxxxxxxxx.git associates the address of the remote warehouse with the local warehouse

Git remote-v can view the addresses that have been added

Step 7, merge the remote library with the local library

Git pull-- rebase origin master Note: there are two minus signs, and many people fail to submit because of the lack of this step.

Step 8, push the files from the local warehouse to the remote warehouse

Git push origin master

So your local code has been uploaded to the remote warehouse.

At this point, the study on "how to add a local project to a remote git repository" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report