pull.py文件 #7

Open
markino wants to merge 4 commits from markino/PRWelBot4SECourse:master into master
First-time contributor

#!/usr/bin/env python3

import os
import subprocess

def pull(remote_url, local_path):
"""从远程仓库拉取代码到本地路径"""
command = f"git -C {local_path} pull {remote_url}"
process = subprocess.run(command, shell=True, check=True)
if process.returncode != 0:
print(f"拉取失败: {process.stderr}")
return False
print(f"拉取成功!")
return True

def main():
# 设置远程仓库 URL 和本地路径
remote_url = "your_remote_url"
local_path = "/path/to/local/repo"

# 拉取代码  
pulled = pull(remote_url, local_path)  
if pulled:  
    print("更新已应用!")  
else:  
    print("更新失败!")  

if name == "main":
main()

#!/usr/bin/env python3 import os import subprocess def pull(remote_url, local_path): """从远程仓库拉取代码到本地路径""" command = f"git -C {local_path} pull {remote_url}" process = subprocess.run(command, shell=True, check=True) if process.returncode != 0: print(f"拉取失败: {process.stderr}") return False print(f"拉取成功!") return True def main(): # 设置远程仓库 URL 和本地路径 remote_url = "your_remote_url" local_path = "/path/to/local/repo" # 拉取代码 pulled = pull(remote_url, local_path) if pulled: print("更新已应用!") else: print("更新失败!") if __name__ == "__main__": main()
markino added 2 commits 2023-12-07 23:01:03 +08:00
markino added 1 commit 2023-12-20 19:38:46 +08:00
markino added 1 commit 2023-12-20 19:41:00 +08:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.
You can also view command line instructions.

Step 1:

From your project repository, check out a new branch and test the changes.
git checkout -b markino-master master
git pull master

Step 2:

Merge the changes and update on Gitea.
git checkout master
git merge --no-ff markino-master
git push origin master
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Trustie-Study-Group/PRWelBot4SECourse#7
No description provided.