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 upload a code file to SAE using Git or SVN

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article focuses on "how to use Git or SVN to upload code files to SAE", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to upload code files to SAE using Git or SVN.

Overview

Currently, applications on SAE support deploying code through Git and SVN.

Git warehouse address https://git.sinacloud.com/YOUR_APP_NAME

SVN warehouse address https://svn.sinacloud.com/YOUR_APP_NAME

User name SAE secure mailbox

Password SAE security password

Notes

User name and password are secure email and security password, not Weibo account and Weibo password! If micro-shield dynamic password is enabled, the password should be "security password" + "micro-shield dynamic password"

Use the Git client

Notes

Git code deployment only supports newly created applications, while existing applications that have been deployed using SVN cannot be deployed using Git.

Suppose you just created the application newapp.

First, create a new Git repository and add a Git remote repository sae at: https://git.sinacloud.com/newapp.

The code is as follows:

$mkdir newapp & & cd newapp

$git init

$git remote add sae https://git.sinacloud.com/newapp

Upload the code. For example, deploy the code of the main branch of Git (master) to version 1 on the SAE server:

The code is as follows:

$touch index.php

$git add index.php

$git commit-m "initial commit"

$git push sae master:1

Remove the version 1 code from the SAE server.

The code is as follows:

$git push sae: 1

On SAE, the application version corresponds to the remote branch of Git. For more information, please see: application directory, application version directory, application version.

Git help documentation: https://git-scm.com/book/zh/v1

Finally, you can use credential helper to avoid entering a password every time you submit. How to configure it can be found in: https://help.github.com/articles/caching-your-github-password-in-git/

If you use a previous version of Git-1.7.10, you may encounter the following problems in git clone or git push. Please upgrade the Git version before using it.

The code is as follows:

Error: The requested URL returned error: 401 while accessing

Https://git.sinacloud.com/repo/info/refs?service=git-receive-pack

Fatal: HTTP request failed

Error: The requested URL returned error: 403 while accessing

Https://git.sinacloud.com/repo/info/refs

Fatal: HTTP request failed

Error: https://git.sinacloud.com/repo/info/refs not found: did you run git

Update-server-info on the server?

Notes

The application profile config.yaml will not be deployed to the user's code directory, but will be stored in the server-side Git repository.

Use the SVN client

TortoiseSVN client

Notes

If there is a problem with the deployment code using TortoiseSVN 1.8.x, try updating to the latest version or using a version below 1.8.

The Tortoise SVN client is recommended under Windows. TortoiseSVN is a free open source client for the Subversion version control system that can manage files and directories over time. Files are stored in a central version repository (that is, SAE's central SVN repository), which is very much like an ordinary file server, except that it can remember every change to the file and directory. You can restore the file to the previous version, and you can check the history to know what changes were made to the data and who made the changes. This is why many people regard Subversion and version control systems as "time machines".

TortoiseSVN download: http://tortoisesvn.net/downloads.html

Deploying code to SAE using TortoiseSVN is described in detail below.

The first step, as shown in the figure, is to create a new folder as the local working directory (Working directory), using the application name as the folder name. For example, create a local working directory for my application devcenter.

The second step is to check out (checkout) the full version code of an application from SAE's SVN repository, as shown in figure 2, right-> click "SVN Checkout"

Enter the warehouse path in the pop-up page. Here is: https://svn.sinacloud.com/devcenter/ and other default parameters, as shown below:

At Reversion, "HEAD revision" refers to the latest version, or you can specify Revision as any version.

Click "OK" and the download screen appears, as shown in the figure:

If all goes well, all version codes of the devcenter application will appear under the devcenter folder you just created, as shown in the figure:

Use your favorite editor locally, edit any file, and the file icon will show a red exclamation point after saving, as shown in the figure:

Look, the index.php that has just been modified has changed color. Next you need to submit (commit) the latest updates. Right-click on the index.php file and a menu appears

Select "SVN commit" as shown in the figure:

Then fill in the log (log message) about this update, which is required, otherwise commit will fail. As shown in the figure:

When you see the following figure, it shows that the modification has been successfully submitted, and the SVN version number of the former devcenter project is increased by 1 to 30. 0.

In the SVN working directory, for file modifications, only commit is needed to ok after completion, but for new files, or files or folders copied from other directories, you need to do an add operation before commit, that is, files or folders are added to the svn working directory, otherwise the SVN client will not recognize it. The specific operation is very simple, as shown in the figure:

Then right-click commit.

At this point, I believe you have a deeper understanding of "how to use Git or SVN to upload code files to SAE". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Servers

Wechat

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

12
Report