Fork me on Gitee

Git常用操作

常用操作

1. 仓库创建Git项目

gitLab或者Github上创建一个空白项目 shiro-demo,获得项目仓库地址:https://gitee.com/xxx/shiro-demo.git

2. 本地电脑上执行Git 全局设置:

```
git config --global user.name "git账户的用户名"
git config --global user.email "git账户的邮箱"
```

3. 如果本地从0开始编写代码,需要先创建 git 仓库:

```
mkdir shiro-demo
cd shiro-demo
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/xxx/shiro-demo.git
git push -u origin master
```

4. 本地已有仓库,则直接与仓库建立联系

```
cd existing_git_repo
git remote add origin https://gitee.com/xxx/shiro-demo.git
git push -u origin master
```
posted @ 2021-11-05 00:20  江南西道  阅读(31)  评论(0)    收藏  举报
Fork me on GitHub