GitLab用户切换引发的某程序员“暴动”,怒而开源项目源码
一个GitLab如何在本机切换账户配置并上传项目
二是项目源码开放,SpringBoot搭建多线程定时任务
GitLab在本机切换账户配置并上传项目
1、进入控制面板,新增git账户,配置用户名及密码2、在gitBash上切换账户3、上传项目
之前已经在本机创建了一个Vue项目,同事给了我一个GitLab账号叫我使用他的账号上传一下项目。 但是我本机的配置是我自己的git账号,那么如何切换呢?在此将相关操作罗列如下:



输入指令“git init”初始化git项目,在当前文件夹下创建了一个.git文件。但是这不我发现了一个问题:

git config --global user.name "XXX"
git config --global user.email "XXX"
12

$ git config --global user.password "XXXX"
1

bash: !@@202003: event not found
git config --list
1


Git 全局设置
git config --global user.name "XXX"
git config --global user.email "XX@XX.com"
创建新版本库
git clone http://172.16.XX.XXX/XX/XX-website.git
cd e-apo-website
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
已存在的文件夹(我目前采用的情况)
cd existing_folder
1>初始化
git init
2>创建一个本地远程链接
git remote add origin http://172.16.XX.XXX/XX/XX-website.git
3>添加到本地
git add .
4>设置注释
git commit -m "Initial commit"
5>推到远程
git push -u origin master
123456789101112131415161718192021222324

1 git rm -r -f --cached ./ (删除缓存)
2 git add . (添加该目录下所有文件)
3 git push -u origin master (这时候提交就没问题了)
12345
上传项目代码
多线程的目的是:使同一个定时任务模块的两个不同的定时任务业务不互相影响。在SpringBoot中集成了定时任务的简单配置
package com.resource.task;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
* @program: travel-res-service
* @description: 定时任务
* @author: Andrea
* @create: 2019-11-15 14:54
**/
//@Component
@Configuration//标记启动类,兼备Component效果
@EnableScheduling//开启定时任务
@EnableAsync//多线程标记(两个定时任务不互相影响)
public class CornJob {
//或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000)
//3.添加定时任务
@Async
@Scheduled(cron = "0 50 2 * * ?")//每天2:50分执行
public void cleanSegDatas() {
boolean b = //定时执行业务1的返回结果
if (b){
System.out.println("执行业务1完成");
}
System.err.println("执行执行业务1定时任务时间: " + LocalDateTime.now());
}
@Async
@Scheduled(cron = "0 0 3 * * ?")//每天3:00分执行
public void cleanTraRouteDatas() {
boolean b = //定时执行业务2的返回结果
if (b){
System.out.println("业务2完成");
}
System.err.println("执行业务2定时任务时间: " + LocalDateTime.now());
}
}