设置global config
bash
git config --global user.name "username"
git config --global user.email "username@email.com"
创建一个新的repository
bash
git clone ssh://git@172.17.1.10:222/username/git_test.git
cd git_test
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
将已有的文件上传到git
bash
cd existing_folder
git init
git remote add origin ssh://git@172.17.1.10:222/username/git_test.git
git add .
git commit -m "Initial commit"
git push -u origin master
将已有的repository上传到git
bash
cd existing_repo
git remote rename origin old-origin
git remote add origin ssh://git@172.17.1.10:222/username/git_test.git
git push -u origin --all
git push -u origin --tags
误删除本地.git文件夹,可以重新建立连接
bash
git init
git remote add origin ssh://git@172.17.1.10:222/username/git_test.git
git pull origin master
git add .
git commit -m "1"
git push -u origin master
删除远程git仓库的文件/文件夹
bash
// 删除文件
git rm --cached state_car_frame_rect.cpp
// 删除文件夹
git rm -r --cached tmp
git commit -m "delete"
git push -u origin master
或者
- 进入 Projects ->Your projects
- 点击进入你要删除的仓库名称 -> 左侧 Settings
- 鼠标滚动到最下面,找到Advanced 点击 Expand
- 鼠标滚动到最下面,找到Remove project 点击 Remove project
- 在弹出的窗口中,输入并确认想要删除的仓库名称,点击 Confirm