Browse Source

fix .git error

liuyuqi-dellpc 2 years ago
parent
commit
0dbd5ef2ca
2 changed files with 12 additions and 1 deletions
  1. 11 0
      README.md
  2. 1 1
      repo_sync/sync_utils.py

+ 11 - 0
README.md

@@ -25,3 +25,14 @@ python repo_sync.py --debug true --repo data/repo.txt --type github
 ```
 ```
 python repo_sync.py --type gitlab
 python repo_sync.py --type gitlab
 ```
 ```
+
+## 计划任务
+
+1、项目以 zhizhou/github 作为项目源,同步到其他平台。
+2、同步项目最好每月定时执行一次,以防止代码丢失。
+
+```bash
+vim /etc/crontab
+
+0 0 1 * * python repo_sync.py --type github
+```

+ 1 - 1
repo_sync/sync_utils.py

@@ -34,7 +34,7 @@ class SyncUtils:
         with open("repos.text", "r") as f:
         with open("repos.text", "r") as f:
             repos = f.readlines()
             repos = f.readlines()
         for repo in repos:
         for repo in repos:
-            repo_name = repo.split("/")[-1]
+            repo_name = repo.split("/")[-1].replace(".git","")
             user_name=repo.split("/")[-2]
             user_name=repo.split("/")[-2]
             if not os.path.exists(user_name):
             if not os.path.exists(user_name):
                 os.mkdir(user_name)
                 os.mkdir(user_name)