Git新建仓库

命令集合

Posted by Mingke Fan on November 26, 2018

Command line instructions

Git global setup

git config --global user.name "yourusername"
git config --global user.email "youremail"

Create a new repository

git clone git@git.chenniao.com:FanMingke/EmotionRecognition.git
cd EmotionRecognition
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master

Existing folder

cd existing_folder
git init
git remote add origin git@git.chenniao.com:FanMingke/EmotionRecognition.git
git add .
git commit
git push -u origin master

重要:如果遇到无法推送到远程仓库,比如远程仓库已有readme文件 则需要先pull远程仓库,merge发生冲突的文件,再进行push

git pull origin master --allow-unrelated-histories
git add .
git commmit -m "merge"
git push origin master

Existing Git repository

cd existing_repo
git remote add origin git@git.chenniao.com:FanMingke/EmotionRecognition.git
git push -u origin --all
git push -u origin --tags`