In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use Git code warehouse management applied on SAE". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
To use Git for code management, first install the Git client locally. Download link: http://www.git-scm.com/download/
The process of installing and configuring the Git client is omitted here.
The operating system used in this example is Windows 8.1, the application language is Python, and the application name is gitsrc.
0. The choice of code management mode
When we first manage the code of the application, there is one and only one opportunity to choose the code base management mode, here we choose Git.
The code management method applied hereafter will not be changed.
After the creation is completed, you can see the Git repository address of the application on the page: https://git.sinaapp.com/gitsrc/
1. Use git clone to clone the code repository
At the command prompt (cmd), cd to the working directory (E:\ sae in this case) and execute the command:
The code is as follows:
Git clone-o sae https://git.sinaapp.com/gitsrc
Where gitsrc should be replaced with the correct application name
Follow the prompts to enter a secure mailbox and password, and after successful execution, prompt that the check-out content is empty.
Save the Git username and password:
In the% USERPROFILE%\ _ netrc file
Add the following to avoid repeatedly entering a user name and password every time you push (no OTP enabled)
The code is as follows:
Machine git.sinaapp.com
Login secure mailbox
Password password
Add a Git remote warehouse sae at: https://git.sinaapp.com/gitsrc
The code is as follows:
Git remote add sae https://git.sinaapp.com/gitsrc
Note: if the-o sae parameter is added to git clone, this step can be omitted.
two。 Create a branch for the first time (version 1)
Add a file, such as index.wsgi, under the source directory gitsrc, and then cd to the source directory and execute the following instructions:
The code is as follows:
Cd gitsrc
Git add.
Git commit-am "init repo"
Git push sae master:1
The print message is as follows:
The code is as follows:
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2amp 2), done.
Writing objects: 100% (3 bytes), 371 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://git.sinaapp.com/gitsrc
* [new branch] master-> 1
3. Switch between versions:
The SAE Git code repository supports multiple coexisting versions of code through Branch.
Use the git checkout command to switch between versions, such as executing a command:
The code is as follows:
Git checkout 1
Switched to branch'1'
Your branch is up-to-date with 'sae/1'.
When the execution is complete, switch to Branch 1
4. Add and remove code versions
Currently at branch 1, execute the following statement to create a branch version (for example, version 2):
The code is as follows:
Git branch 2
Git push sae 2
You can list all versions by executing the following command
The code is as follows:
Git branch-a
Remove the version 2 code from the SAE server.
The code is as follows:
Git push sae: 2
Deletion is prohibited when it has been specified as the default version in SAE.
Error message: Permission denied: deleting default version is not allowed!
5. Submit code changes to the Git code base
Change the code file in the gitsrc directory, for example, add the file foo.html
Execute the following statement in turn to commit the changes to the SAE Git code base (branch version 1):
The code is as follows:
Git add-all
Git commit-am "add foo.html"
Git push sae 1
For Python applications, unlike the SVN code base, index.wsgi is not generated by default in the new version. Developers need to add this file by themselves.
This is the end of the content of "how to use the Git code warehouse management applied on SAE". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.