gitcode代码仓库的基本使用

一、gitcode官网简介

GitCode 是 CSDN 为开发者提供的开源项目创新服务平台,秉承“创新、开放、协作、共享”的开源价值观,致力于为大规模开源开放协同创新助力赋能,打造创新成果孵化和新时代开发者培养的开源创新生态!支持公有云使用、私有化部署以及软硬一体化私有部署。

二、本地配置

1.安装git工具

yum -y install git

2.配置本地git信息

[root@compute-node1 gitcode]# git config --global user.name "wangming"
[root@compute-node1 gitcode]# git config --global user.email "123456@qq.com"
[root@compute-node1 gitcode]# git config --global color.ui true
[root@compute-node1 gitcode]# 

3.查看git个人信息

[root@compute-node1 gitcode]# cat ~/.gitconfig 
[user]
	name = wangming
	email = 123456@qq.com
[color]
	ui = true

二、创建本地仓库

1.创建本地工作区

[root@compute-node1 gitcode]# git init .
Initialized empty Git repository in /git/gitcode/.git/
[root@compute-node1 gitcode]# ls -a
.  ..  found_file.sh  .git
[root@compute-node1 gitcode]# 

2.将文件放入暂存区

[root@compute-node1 gitcode]# git add .

3.将暂存区文件放入本地仓库

[root@compute-node1 gitcode]# git commit -m "1.0 master-wangming create item for test scripts  "
[master (root-commit) f1491e2] 1.0 master-wangming create item for test scripts
 1 file changed, 21 insertions(+)
 create mode 100755 found_file.sh

4.查看版本记录

[root@compute-node1 gitcode]# git log --oneline 
f1491e2 1.0 master-wangming create item for test scripts

三、gitcode网站个人仓库配置

1.登录个人仓库

在这里插入图片描述

2.新建个人仓库

在这里插入图片描述

3.查看个人仓库

在这里插入图片描述

四、连接远程仓库

1.连接gitcode

[root@compute-node1 gitcode]# git remote add origin https://gitcode.net/jks212454/it-items.git
[root@compute-node1 gitcode]# 

2.查看连接状态

[root@compute-node1 gitcode]# git remote -v
origin	https://gitcode.net/jks212454/it-items.git (fetch)
origin	https://gitcode.net/jks212454/it-items.git (push)

五、配置ssh免密

1.查看本机公钥

[root@compute-node1 gitcode]# cat ~/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjmRSBowMRzqDO4JFwveGTYZ/CtaOWKEu/G5GZ5HwYDDa/+Hps03DzXnOffkZARkPPmNNFVzE1/mCVA3LpMMDCeV3JfgrLLYSmwY4cNTgVMQ4NLs0uk4UkmBGwb/nP1IYX9Z+qpmGe/caUOFXGdvsGPRtjXC9llUGJCn1U4tkyhjX1hiwuPPlFl4XHw5w0EyCRwTtzzTn1Ma66DN5Ovc644GIbECnhVyOcXbzroZeiN3Ms+XfhVA/m9gCj9gXo+AUFC1wgHvwoBOLkx+PjKhOMz/nz4lSVEd/yURBGlcM6+wKYbTzeSdWGh0TG8mIMIBPd+vRIbNfW6R96NR/SLTMl root@localhost.localdomain

2.添加公钥到gitcode

在这里插入图片描述

六、上传文件到gitcode

[root@compute-node1 gitcode]# git push git@gitcode.net:jks212454/it-items.git
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

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)

Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 842 bytes | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To git@gitcode.net:jks212454/it-items.git
   56dcb17..24c29d9  master -> master
[root@compute-node1 gitcode]# 


七、gitcode查看

在这里插入图片描述

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Visual Studio Code是一款非常流行的轻量级代码编辑器,它内置了Git支持,使得代码管理变得简单。以下是使用VS Code上传Git代码基本步骤: 1. **安装Git**: 首先,确保你的电脑上已经安装了Git。如果没有,你可以从Git官网(https://git-scm.com/downloads)下载并安装。 2. **打开VS Code**: 打开VS Code,点击左上角的"文件"菜单,然后选择"打开文件夹"或直接拖拽项目文件到VS Code中打开项目。 3. **初始化Git仓库**: 在项目根目录下,按`Ctrl+Shift+P`(Windows/Linux)或`Cmd+Shift+P`(Mac),输入`Git: Init`,点击回车初始化一个新的Git仓库。 4. **添加文件到暂存区**: 选中你想要提交的文件,右键点击选择"Git: Add"或使用快捷键`Ctrl+Shift+A`(Windows/Linux)或`Cmd+Shift+A`(Mac),将文件添加到暂存区。 5. **提交更改**: 输入提交信息,如"Initial commit"或描述你的更改,然后使用`Git: Commit All`(快捷键通常是`Ctrl+K, Ctrl+Enter` 或 `Cmd+K, Cmd+Enter`)来提交你的更改。 6. **关联远程仓库**: 如果项目已有远程仓库,可以点击"Source Control"面板,然后选择"添加远程"(`Git: Add Remote`),输入仓库地址(通常是`https://github.com/your-username/your-repo.git`)。 7. **推送代码**: 在"Source Control"面板中选择你的分支(默认是master),点击"Push to..."按钮,输入远程仓库的用户名和密码(第一次可能需要创建个人访问令牌),然后点击推送。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

江湖有缘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值