gitee上传代码到仓库linux
时间: 2023-11-07 19:19:07 浏览: 123
要将代码上传到Gitee仓库,需要按照以下步骤操作:
1. 在 Linux 终端中,进入你的代码所在的文件夹。
2. 初始化本地仓库,运行以下命令:
```bash
git init
```
3. 将代码添加到本地仓库,运行以下命令:
```bash
git add .
```
这将添加当前文件夹下的所有文件到仓库中。如果只想添加特定的文件,可以指定文件路径,例如:
```bash
git add path/to/file
```
4. 提交代码到本地仓库,运行以下命令:
```bash
git commit -m "Initial commit"
```
替换 "Initial commit" 为你想要的提交信息。
5. 在 Gitee 上创建一个新的空仓库。
6. 添加远程仓库地址,运行以下命令:
```bash
git remote add origin 远程仓库地址
```
替换 "远程仓库地址" 为你在 Gitee 上创建的仓库地址。例如:
```bash
git remote add origin https://gitee.com/你的用户名/你的仓库名.git
```
7. 推送代码到远程仓库,运行以下命令:
```bash
git push -u origin master
```
这将把本地代码推送到远程仓库的 master 分支。如果你想推送到其他分支,请将 "master" 替换为相应的分支名。
完成以上步骤后,你的代码将被上传到 Gitee 仓库中。
阅读全文
相关推荐


















