手把手教你如何上传代码到gitee服务器
gudong366 2025-05-12 12:21 18 浏览
之前编写了几个适合新手的小项目, 为方便大家学习和下载代码, 决定把代码上传到gitee服务器。
不得不说,git是一个非常好用的代码版本管理工具,
本文手把手教大家如何将自己编写的代码上传到Gitee。
1. 注册账号
打开网页
https://gitee.com/
点击注册, 输入一个自己喜欢的域名,yikoulinux 输入手机号,验证即可
点击注册并绑定 即可。
2.绑定微信
点击头像->设置
然后会弹出二维码, 用自己的微信扫描二维码即可。
2. 绑定邮箱
后续版本管理操作需要绑定邮箱才能继续操作。
点击头像->设置
点击 左边邮箱管理->新增 然后输入刚才设置的gitee登录密码
正确会进入下面页面, 输入自己的邮箱(一口君用的QQ邮箱)
点击确定
然后登录自己邮箱,点击对应的链接即可。
3. 新建仓库
点击头像左侧的+ -> 新建仓库
输入名称以及开源许可证等。
点击创建即可。
4. clone克隆仓库到本地
复制仓库链接:
进入ubuntu 如果没有安装git,可以执行以下命令安装git
sudo apt-get install git
配置git全局环境
git config --global user.name "yikoulinux"
git config --global user.email "7335817@qq.com"
修改commit默认打开的文本编辑工具
git config --global core.editor "vim"
开始克隆:
root@ubuntu:/home/peng/work# git clone https://gitee.com/yikoulinux/encryption.git
Cloning into 'encryption'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
Checking connectivity... done.
查看克隆下来的文件夹
root@ubuntu:/home/peng/work# ls
encryption
root@ubuntu:/home/peng/work# cd encryption/
root@ubuntu:/home/peng/work/encryption# ls
LICENSE
查看git log
root@ubuntu:/home/peng/work/encryption# git log
commit 5e0d6d12afb34a8082c6ef60f34f6e615c99746e
Author: 一口Linux <10221187+yikoulinux@user.noreply.gitee.com>
Date: Tue Dec 21 13:57:19 2021 +0000
Initial commit
拷贝代码到当前目录
root@ubuntu:/home/peng/work/encryption# ls
key.c key.h LICENSE main.c README.md
其中README.md是文档说明,采用Markdown格式编写。
添加源文件到本地仓库:
root@ubuntu:/home/peng/work/encryption# git add *
root@ubuntu:/home/peng/work/encryption# git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: LICENSE
new file: README.md
new file: key.c
new file: key.h
new file: main.c
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
执行commit
root@ubuntu:/home/peng/work/encryption# git commit
添加commit 的 log信息【此时编辑工具是vim】
上传到服务器:
root@ubuntu:/home/peng/work/encryption# git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Username for 'https://gitee.com': yikoulinux
Password for 'https://yikoulinux@gitee.com':
Counting objects: 6, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 2.28 KiB | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.2]
To https://gitee.com/yikoulinux/encryption.git
5e0d6d1..484d5d4 master -> master
其中会要求输入用户名(开头设置的名字yikoulinux)密码,密码输入时不会回显。
最终在gitee上显示结果:
这样我们就成功的将本地代码上传到服务器了。
5. 常用git命令
git clone 项目地址 拉项目
git pull 拉代码
git push 提交到仓库
git init 指令初始化一个git仓库
git add .添加文件
git commit -m "注释"提交至仓库。
git remote add origin https://git.oschina.net/你的用户名/项目名.
git,git push origin master即可完成推送
git checkout master 切换到master分支
6. 如果不想每次都输入用户名密码可以
(1)生成ssh密钥
ssh-keygen -C '7335817@qq.com' -t rsa
会在用户目录~/.ssh/下建立相应的密钥文件。 如果是管理员创建在目录/root/.ssh/下。
(2)上传公钥
使用命令cd ~/.ssh进入~/.ssh文件夹,输入
cat id_rsa.pub
打开id_rsa.pub文件,复制其中所有内容。接着访问git网页,点击SSH公钥,标题栏可以随意输入,公钥栏把刚才复制的内容粘贴进去。
此外,一口君还创建了一个基于Linux的聊天室的开源项目, 基功能包括登录、注册、公聊、私聊、数据库、数据加密等功能。 其他功能后续会陆续完善。
https://gitee.com/yikoulinux/chat.git
最后欢迎各位给我的开源项目点个星!
感谢了!
相关推荐
- 使用再生龙工具远程克隆Linux服务器
-
大家好,之前给大家介绍一个一款可以用来备份还原、远程克隆、P2V、V2V的工具--再生龙,今天就来给大家演示如何用该工具来远程克隆一台linux服务器。使用此方法,可以将一台物理服务器远程克隆到虚拟...
- Linux 下用 SSH 登录远程服务器后把远程服务器文件传本地电脑
-
在Linux下,使用SSH命令登录远程服务器后,可以使用scp命令将远程服务器上的文件复制到本地电脑。以下是scp命令的基本用法:scp[用户名]@[远程服务器地址]:[远程文件路径][本地存放路...
- 一文掌握怎么利用Shell+Python实现Linux系统数据异地备份程序
-
简介:在当今的信息化时代,数据安全已成为企业和个人运维的重中之重。无论是服务器宕机、硬盘损坏,还是遭遇勒索病毒,数据丢失都可能带来巨大损失。为了最大程度保障数据安全,异地备份成为了最佳实践之一。本文将...
- 如何在Linux上搭建本地Docker Registry并实现远程连接
-
在Linux上搭建本地DockerRegistry并实现远程连接,可以按照以下步骤操作:一、安装Docker确保Linux系统上已经安装了Docker。如果尚未安装,可以使用以下命令进行安装(以Ub...
- 服务器连接方法教程(服务器地址怎么连接)
-
连接服务器的方式多种多样,具体取决于服务器的类型、操作系统以及你的使用需求。以下是几种常见的服务器连接方法,包含详细步骤和注意事项:一、远程桌面连接(适用于Windows服务器)适用场景:需要图形...
- 自动化测试学习:使用python库Paramiko实现远程服务器上传和下载
-
前言测试过程中经常会遇到需要将本地的文件上传到远程服务器上,或者需要将服务器上的文件拉到本地进行操作,以前安静经常会用到xftp工具。今天安静介绍一种python库Paramiko,可以帮助我们通过代...
- 手把手教你安装、远程连接Ubuntu 22.04
-
Ubuntu分为桌面版和服务器版本,我们选择服务器版本1下载Ubuntu22.04Ubuntu22.04下载地址:https://releases.ubuntu.com/22.04/ubuntu...
- Windows服务器怎么连接?远程连接服务器命令
-
服务器操作系统可以实现对计算机硬件与软件的直接控制和管理协调,任何计算机的运行离不开操作系统,服务器也一样,服务器操作系统主要分为四大流派:WindowsServer、Netware、Unix和Li...
- 如何使用JuiceSSH实现手机端远程连接Linux服务器
-
在当今数字化时代,远程连接到服务器成为了许多人工作和生活中的必需品。JuiceSSH是一款比较强大的Android应用程序,它可以让您在手机上轻松地远程连接到Linux服务器。下面简单的向您介绍如何使...
- 本地电脑如何远程连接服务器(电脑如何远程桌面连接服务器)
-
下面就来说说如何远程登录服务器。服务器一般有两大类系统,一种是windows系统,一种是Linux系统。下面以Windows系统为例1、Windows系统有自带的登录系统,点击“运行”(或者windo...
- 如何用CHAT配置linux的远程连接?(chattr linux)
-
问CHAT:配置linux的远程连接1.下载ssh2.启动ssh服务3.查看ssh服务状态4.设置ssh服务开机自启动5.设置windows的cmd下ssh6.通过cmd的ssh命令远程到...
- 服务器怎么远程连接控制(服务器远程桌面连接设置方法)
-
我是艾西,还是有很多小白同学问我服务器怎么远程连接。那么今天我们重点来教教大家如何用电脑远程服务器配上图文教程,让不懂的新手小白一看就会,分分钟上手教程远程服务器需要一台电脑俗称“PC”就是我们自己平...
- 如何远程管理Linux服务器(linux远程登录管理)
-
在当今数字化的时代,Linux服务器凭借其稳定性和高效性,成为众多企业和开发者的首选。然而,很多时候我们无法直接在服务器前操作,这就需要掌握远程管理Linux服务器的技巧啦。别担心,今天就来给大家分享...
- Linux系统无法启动?别慌!这可能是全网最全的故障排查攻略
-
当Linux系统罢工时,盲目重装只会浪费时间!本文整理8种常见故障的解决方案,涵盖从引导修复到硬件检测全流程,建议收藏备用。一、引导阶段故障排查1.GRUB引导丢失现象:黑屏显示"grub&...
- Linux进程管理(linux进程管理实验报告)
-
原作者:Linux教程,原文「链接」:https://mp.weixin.qq.com/s/39rQMl3V2Egot9cZ14NCLg【获得原作者转载授权】每个计算机系统都包含一个核心软件集合,即操...
- 一周热门
- 最近发表
- 标签列表
-
- linux一键安装 (31)
- linux运行java (33)
- ln linux (27)
- linux 磁盘管理 (31)
- linux 内核升级 (30)
- linux 运行python (28)
- linux 备份文件 (30)
- linux 网络测试 (30)
- linux 网关配置 (31)
- linux jre (32)
- linux 杀毒软件 (32)
- linux语法 (33)
- linux博客 (33)
- linux 压缩目录 (37)
- linux 查看任务 (32)
- 制作linux启动u盘 (35)
- linux 查看存储 (29)
- linux乌班图 (31)
- linux挂载镜像 (31)
- linux 软件源 (28)
- linux题目 (30)
- linux 定时脚本 (30)
- linux 网站搭建 (28)
- linux 远程控制 (34)
- linux bind (31)