셸 스 크 립 트 원 키 를 누 르 면 github 과 gitee 로 코드 를 동시에 푸 시 하 는 해결 방법
1.git 초기 화
자신의 프로젝트 디 렉 터 리 에 들 어가 git 를 실행 합 니 다. init
cd /app/code/go-study
git init
2.다음 스 크 립 트 실행:
#!/bin/bash
#author Oliver
#since 2020-09-03 15:24:31
git remote rm origin
#replace your git location
git remote add origin 'https://github.com/**********'
git pull remote master
git add .
git commit -m $1
git push origin master --force
if [ "$?" = "0" ]
then
echo -e "\033[42;34m push to github success! \033[0m"
else
echo -e "\033[41;30m push to github fail! \033[0m"
exit 1
fi
git remote rm origin
#replace your git location
git remote add origin 'https://gitee.com/**********'
git pull remote master
git add .
git commit -m $1
git push origin master --force
if [ "$?" = "0" ]
then
echo -e "\033[42;34m push to gitee success! \033[0m"
else
ech -e "\033[41;30m push to gitee fail! \033[0m"
exit 1
fi
3.셸 스 크 립 트 를 실행 하면 git 에서 제출 한 msg 인 자 를 전달 할 수 있 습 니 다.
./shell.sh " "
PS:git 가 로 컬 코드 를 강제로 덮어 쓰 고 원 격 창고 로 강제 푸 시 하 는 것 을 보 겠 습 니 다.1.git 로 컬 파일 강제 덮어 쓰기(git 원 격 창고 와 일치 함):
git fetch --all
git reset --hard origin/master
git pull
git ( ):
git fetch --all && git reset --hard origin/master && git pull
2.git 로 컬 코드 를 원 격 창고 로 강제 전송파일 을 업로드 할 폴 더 아래로 전환 하여 명령 을 실행 합 니 다.
git push -u origin develop
총결산여기 서 셸 스 크 립 트 를 원 키 로 동시에 github 과 gitee 로 푸 시 하 는 글 을 소개 합 니 다.더 많은 셸 푸 시 코드 를 github 과 gitee 로 푸 시 하 는 내용 은 예전 의 글 을 검색 하거나 아래 의 관련 글 을 계속 찾 아 보 세 요.앞으로 도 많은 응원 부 탁 드 리 겠 습 니 다!
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
✨〰️ ZI 〰️✨ Vim 구문❮ ZI ❯ 🧙♀️ Zsh를 위한 스위스 아미 나이프. 모든 것을 함께 붙일 수 있도록 설계되었습니다. zsh 유형의 파일에 있는 명령에 대한 Vim 구문 정의입니다. 📥 설치 Vim 플러그인으로 로드합니다. 예를...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.