1. Install the Git client software
There are a lot of software on the Git client, here Lao Jiang is using Git for Windows (http://msysgit.github.io /). When I wrote this article, I used the Windows system computer, so I used the client software. On MAC, I directly use the console that comes with the system.
There is no difficulty in installing the software. After installation is completed step by step, we can see that some options are added when you right-click the property.
Install Git first, and we will continue to use it.
2. Create a remote warehouse
Generally, we use a third-party Git remote repository. For example, GitHub is widely used in foreign countries and CODING. NET, GITCAFE, and OSCHINA in China. Or we can deploy a private repository on our own. The basic functions are the same no matter where the repository is used. It is nothing more than registering an account in these third-party platforms, creating a private or shared warehouse, and then pushing local files.
For an intuitive demonstration, Mr. Jiang uses CODING here. NET is a project management platform in China, which is the same for other platforms. It is only for convenience demonstration and simplified Chinese interface. The average user looks more friendly. As mentioned in the article "deploying a personal homepage website free of charge using Coding.net code hosting space", if we know Chinese characters, we will certainly register an account.
The most important thing here is to create a repository in the remote repository so that we can submit local files to the repository.
On the Coding background page, we can see the Create project button. Create a project first.
The project name here is taken by ourselves. To know which project warehouse to store and which project to store, we need to understand. Don't submit the error at that time.
3. Open the Git client to connect to the repository
A-find A location on our local computer and create A folder to store the files in the new warehouse. Then, right-click the folder and select the Git Bash option to open the Git command box.
B-connect to the remote warehouse
Here we need to first find the HTTPS file path from the remote warehouse.
Regardless of the platform, we need local and remote connection. We need to first download the remote file to the local. In this way, we can add a new file in the local file to synchronize and upload it to the remote warehouse.
| The code is as follows: |
Copy code |
Git clone https://git.coding.net/itbulu/gitstudy.git (our own repository path)
|
After downloading, we can check whether there are too many files in the local folder and download our remote repository file to the local.
4. Add and submit remarks
Here, I only share the basic functions of getting started. We all need to push files to the remote repository. For example, here I will drop the downloaded ZBLOG PHP program into the local repository folder.
A-Move the files from the remote repository to the local repository folder.
B-run the cd ls command to check whether the files that have been submitted can be seen in GIT, because a folder is added while the cloned files are not the root directory, therefore, we need the cd command to go to the root directory.
You can view the current file status through git status. Files that have changed need to be uploaded to the remote repository.
C-add a file
| The code is as follows: |
Copy code |
Git add * (or file name)
|
Use the git add command to add the files to be uploaded to the cache, instead of uploading them to the cache. Deploy the files to the cache first. You can use * to represent all files or specify files.
| The code is as follows: |
Copy code |
Git commit-m "remarks"
|
Then, make remarks and submit the remarks for these files so that you can find the modified nodes.
5. Push files
| The code is as follows: |
Copy code |
Git push origin master
|
Push the file to the repository. Because we do not use the public key binding, you must enter the CODING user name and password each time you submit the file. This ensures security.
After the push is complete, let's see if there are too many files in the remote warehouse?
Conclusion: through this article, you can learn how to use GIT to store push files. If you need to study it in depth, we need to contact you more and use some common scripts. Later, Lao Jiang will continue this article and deploy his website in the repository.
S