当前位置: 首页 > news >正文

初次在 GitHub 建立仓库以及公开代码的流程 - 公开代码

初次在 GitHub 建立仓库以及公开代码的流程 - 公开代码

  • References

在已有仓库中添加代码并公开。

  1. git clone 已有仓库

将已有仓库 clone 到本地的开发环境中。

在这里插入图片描述

strong@foreverstrong:~$ mkdir github_work
strong@foreverstrong:~$ cd github_work/
strong@foreverstrong:~/github_work$ ll
total 8
drwxrwxr-x  2 strong strong 4096 Dec 17 14:03 ./
drwxr-xr-x 44 strong strong 4096 Dec 17 14:03 ../
strong@foreverstrong:~/github_work$ git clone https://github.com/ForeverStrongCheng/Hello-World.git
Cloning into 'Hello-World'...
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (3/3), done.
Unpacking objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Checking connectivity... done.
strong@foreverstrong:~/github_work$ ll
total 12
drwxrwxr-x  3 strong strong 4096 Dec 17 14:04 ./
drwxr-xr-x 44 strong strong 4096 Dec 17 14:03 ../
drwxrwxr-x  3 strong strong 4096 Dec 17 14:04 Hello-World/
strong@foreverstrong:~/github_work$ cd Hello-World/
strong@foreverstrong:~/github_work/Hello-World$ ll
total 20
drwxrwxr-x 3 strong strong 4096 Dec 17 14:04 ./
drwxrwxr-x 3 strong strong 4096 Dec 17 14:04 ../
drwxrwxr-x 8 strong strong 4096 Dec 17 14:04 .git/
-rw-rw-r-- 1 strong strong  272 Dec 17 14:04 .gitignore
-rw-rw-r-- 1 strong strong   13 Dec 17 14:04 README.md
strong@foreverstrong:~/github_work/Hello-World$ 
strong@foreverstrong:~/github_work/Hello-World$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
strong@foreverstrong:~/github_work/Hello-World$ 

将想要公开的代码提交至这个仓库再 push 到 GitHub 的仓库中,代码便会被公开。

  1. 编写代码

由于 Hello_World.py 还没有添加至 Git 仓库,所以显示为 untracked files。

strong@foreverstrong:~/github_work/Hello-World$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Untracked files:(use "git add <file>..." to include in what will be committed)Hello_World.pyimage_data/nothing added to commit but untracked files present (use "git add" to track)
strong@foreverstrong:~/github_work/Hello-World$ 
  1. 提交

将 Hello_World.py 提交至仓库。这样一来,这个文件就进入了版本管理系统的管理之下。今后的更改管理都交由 Git 进行。

strong@foreverstrong:~/github_work/Hello-World$ git add .
strong@foreverstrong:~/github_work/Hello-World$ 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)new file:   Hello_World.pynew file:   image_data/lena.jpgstrong@foreverstrong:~/github_work/Hello-World$ 
strong@foreverstrong:~/github_work/Hello-World$ git commit -m "Add Hello World script by Python"
[master a984390] Add Hello World script by Python2 files changed, 21 insertions(+)create mode 100644 Hello_World.pycreate mode 100644 image_data/lena.jpg
strong@foreverstrong:~/github_work/Hello-World$ 

通过 git add 命令将文件加入暂存区,再通过 git commit 命令提交。

添加成功后,可以通过 git log 命令查看提交日志,输入 q 退出 git log 状态。

strong@foreverstrong:~/github_work/Hello-World$ git log
commit a984390cb3c6b756842675b0cd13f00a6c428e6b
Author: chengyq116 <chengyq116@163.com>
Date:   Sun Dec 17 15:23:42 2017 +0800Add Hello World script by Pythoncommit 8054468596d91cfedab242b08b3fa111d8d68aac
Author: Yongqiang Cheng <chengyq116@163.com>
Date:   Sun Dec 17 13:17:11 2017 +0800Initial commit
strong@foreverstrong:~/github_work/Hello-World$ 
strong@foreverstrong:~/github_work/Hello-World$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.(use "git push" to publish your local commits)
nothing to commit, working directory clean
strong@foreverstrong:~/github_work/Hello-World$ 
  1. 进行 push

执行 push, GitHub 上的仓库就会被更新,代码就在 GitHub 上公开了。

strong@foreverstrong:~/github_work/Hello-World$ 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 matchingTo squelch this message and adopt the new behavior now, use:git config --global push.default simpleWhen 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://github.com': chengyq116@163.com
Password for 'https://chengyq116@163.com@github.com': 
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 90.25 KiB | 0 bytes/s, done.
Total 5 (delta 0), reused 0 (delta 0)
To https://github.com/ForeverStrongCheng/Hello-World.git8054468..a984390  master -> master
strong@foreverstrong:~/github_work/Hello-World$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
strong@foreverstrong:~/github_work/Hello-World$ 

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/
[2] (日) 大塚弘记 著, 支鹏浩, 刘斌 译. GitHub入门与实践[M]. 北京:人民邮电出版社, 2015. 1-255
[3] 初次在 GitHub 建立仓库以及公开代码的流程 - 建立仓库, https://yongqiang.blog.csdn.net/article/details/137360191

相关文章:

初次在 GitHub 建立仓库以及公开代码的流程 - 公开代码

初次在 GitHub 建立仓库以及公开代码的流程 - 公开代码 References 在已有仓库中添加代码并公开。 git clone 已有仓库 将已有仓库 clone 到本地的开发环境中。 strongforeverstrong:~$ mkdir github_work strongforeverstrong:~$ cd github_work/ strongforeverstrong:~/git…...

论文笔记 - :MonoLSS: Learnable Sample Selection For Monocular 3D Detection

论文笔记✍MonoLSS: Learnable Sample Selection For Monocular 3D Detection &#x1f4dc; Abstract &#x1f528; 主流做法限制 &#xff1a; 以前的工作以启发式的方式使用特征来学习 3D 属性&#xff0c;没有考虑到不适当的特征可能会产生不利影响。 &#x1f528; 本…...

LVS、HAProxy

集群&#xff1a;将很多个机器组织到一起&#xff0c;作为一个整体对外提供服务。集群在扩展性、性能方面都可以做到很灵活。集群的分类&#xff1a;负载均衡集群&#xff1a;Load Balance。高可用集群&#xff1a;High Available。高性能集群&#xff1a;High Performance Com…...

开发环境->生产环境

1、数据迁移 不涉及docker # 以数据库用户导出数据 mysqldump -h 192.168.1.168 -P 3307 -u abragent -pabragebb17 abragent > abragent.sql# 以root用户导出数据 mysqldump -h 192.168.1.168 -P 3307 -u root -p8d3Ba1b abragent > abragent.sql 涉及docker …...

基于AI智能识别技术的智慧展览馆视频监管方案设计

一、建设背景 随着科技的不断进步和社会安全需求的日益增长&#xff0c;展览馆作为展示文化、艺术和科技成果的重要场所&#xff0c;其安全监控系统的智能化升级已成为当务之急。为此&#xff0c;旭帆科技&#xff08;TSINGSEE青犀&#xff09;基于视频智能分析技术推出了展览…...

Leetcode-894-所有可能的真二叉树-c++

题目详见https://leetcode.cn/problems/all-possible-full-binary-trees/ 主搞动态规划&#xff0c;因为这玩意儿我还不是很懂 关于节点个数为奇数偶数的证明请见官方题解方法一中的如下内容&#xff1a; 这里DP的一个主要思想是&#xff1a;对于任何一个满二叉树&#xff…...

Django DRF视图

文章目录 一、DRF类视图介绍APIViewGenericAPIView类ViewSet类ModelViewSet类重写方法 二、Request与ResponseRequestResponse 参考 一、DRF类视图介绍 在DRF框架中提供了众多的通用视图基类与扩展类&#xff0c;以简化视图的编写。 • View&#xff1a;Django默认的视图基类&…...

SQLite全文搜索引擎:实现原理、应用实践和版本差异

文章目录 一、实现原理1.1 倒排索引1.2 虚拟表 二、应用在工程上的实施方法2.1 创建FTS虚拟表2.2 插入数据2.3 全文搜索2.4 关联普通表2.5 更新和删除数据2.6 优化FTS虚拟表2.7 小结 三、FTS3、FTS4和FTS5的区别3.1 FTS33.2 FTS43.3 FTS53.4 小结 四、更新SQLite的FTS版本的步骤…...

day17-二叉树part04

110.平衡二叉树 &#xff08;优先掌握递归&#xff09;后序遍历 左右中 class Solution {public boolean isBalanced(TreeNode root) {return getHeight(root) ! -1;}//递归三部曲 确定方法的参数与返回值private int getHeight(TreeNode root){//明确终止条件if(root null){r…...

书生浦语第一次课

模型的发展 从专业模型到通用模型 书生浦语大模型全链路开源体系 2023.06.07 -> InternLM千亿参数语言大模型发布 2023.07.06 -> InternLM千亿参数语言大模型全面升级&#xff0c;支持8K语境、26种语言。全面开源、免费商用&#xff1a;InternLM-7B、全链条开源工具…...

UE小:UE5.3无法创建C++工程

当您在使用Unreal Engine (UE) 构建项目时&#xff0c;如果遇到以下问题&#xff1a; Running C:/Program Files/Epic Games/UE\_5.3/Engine/Build/BatchFiles/Build.bat -projectfiles -project"C:/UEProject/Shp\_1/Shp\_1.uproject" -game -rocket -progress Usi…...

FFmpeg获取视频详情

话不多说&#xff0c;直接上代码&#xff1a; pom依赖&#xff1a; <!--视频多媒体工具包 包含 FFmpeg、OpenCV--><dependency><groupId>org.bytedeco</groupId><artifactId>javacv-platform</artifactId><version>1.5.3</versi…...

find: paths must precede expression

find: paths must precede expression 1. find: paths must precede expression2. 请在搜索字符串上添加单引号或者双引号References 1. find: paths must precede expression strongforeverstrong:~/ForeverStrong$ find /home/strong/ForeverStrong/image_results/ -name *.…...

RabbitMQ3.x之九_Docker中安装RabbitMQ

RabbitMQ3.x之_Docker中安装RabbitMQ 文章目录 RabbitMQ3.x之_Docker中安装RabbitMQ1. 官网2. 安装1 .拉取镜像2. 运行容器 3. 访问 1. 官网 rabbitmq - Official Image | Docker Hub 2. 安装 1 .拉取镜像 docker pull rabbitmq:3.13.0-management2. 运行容器 # latest Rabb…...

vue快速入门(四)v-html

注释很详细&#xff0c;直接上代码 上一篇 新增内容 使用v-html将文本以html的方式显示 源码 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, …...

第19次修改了可删除可持久保存的前端html备忘录:换了一个特别的倒计时时钟

第19次修改了可删除可持久保存的前端html备忘录:换了一个特别的倒计时时钟 <!DOCTYPE html> <html lang"zh"> <head><meta charset"UTF-8"><meta http-equiv"X-UA-Compatible" content"IEedge"><met…...

C++ 2024-4-1 作业

#include <iostream> using namespace std;class A { public:int a;A(int a):a(a){cout<<"A的有参构造"<<endl;} }; class B:virtual public A { public:int b;B(int a,int b):A(a),b(b){cout<<"B的有参构造"<<endl;} }; cl…...

【滑动窗口】Leetcode 串联所有单词的子串

题目解析 30. 串联所有单词的子串 本题的意思就是在目标串s中寻找能够找到的words字符串的全排列&#xff0c;返回起始位置 算法讲解 我们可以将这道题转化为寻找目标串的words字母的异位词&#xff0c;按照上一次讲解的【滑动窗口】Leetcode 找到字符串中所有字母异位词我们…...

golang channel实践代码及注意事项

在使用Go语言&#xff08;Golang&#xff09;的通道&#xff08;Channel&#xff09;时&#xff0c;有几个重要的注意点可以帮助开发者更安全、高效地使用它们进行并发编程。以下是一些关键的注意事项&#xff1a; 选择正确的通道类型&#xff1a;Go语言提供了两种类型的通道&…...

面试题:RabbitMQ 消息队列中间件

1. 确保消息不丢失 生产者确认机制 确保生产者的消息能到达队列&#xff0c;如果报错可以先记录到日志中&#xff0c;再去修复数据持久化功能 确保消息未消费前在队列中不会丢失&#xff0c;其中的交换机、队列、和消息都要做持久化消费者确认机制 由spring确认消息处理成功后…...

conda相比python好处

Conda 作为 Python 的环境和包管理工具&#xff0c;相比原生 Python 生态&#xff08;如 pip 虚拟环境&#xff09;有许多独特优势&#xff0c;尤其在多项目管理、依赖处理和跨平台兼容性等方面表现更优。以下是 Conda 的核心好处&#xff1a; 一、一站式环境管理&#xff1a…...

云计算——弹性云计算器(ECS)

弹性云服务器&#xff1a;ECS 概述 云计算重构了ICT系统&#xff0c;云计算平台厂商推出使得厂家能够主要关注应用管理而非平台管理的云平台&#xff0c;包含如下主要概念。 ECS&#xff08;Elastic Cloud Server&#xff09;&#xff1a;即弹性云服务器&#xff0c;是云计算…...

Spark 之 入门讲解详细版(1)

1、简介 1.1 Spark简介 Spark是加州大学伯克利分校AMP实验室&#xff08;Algorithms, Machines, and People Lab&#xff09;开发通用内存并行计算框架。Spark在2013年6月进入Apache成为孵化项目&#xff0c;8个月后成为Apache顶级项目&#xff0c;速度之快足见过人之处&…...

通过Wrangler CLI在worker中创建数据库和表

官方使用文档&#xff1a;Getting started Cloudflare D1 docs 创建数据库 在命令行中执行完成之后&#xff0c;会在本地和远程创建数据库&#xff1a; npx wranglerlatest d1 create prod-d1-tutorial 在cf中就可以看到数据库&#xff1a; 现在&#xff0c;您的Cloudfla…...

系统设计 --- MongoDB亿级数据查询优化策略

系统设计 --- MongoDB亿级数据查询分表策略 背景Solution --- 分表 背景 使用audit log实现Audi Trail功能 Audit Trail范围: 六个月数据量: 每秒5-7条audi log&#xff0c;共计7千万 – 1亿条数据需要实现全文检索按照时间倒序因为license问题&#xff0c;不能使用ELK只能使用…...

06 Deep learning神经网络编程基础 激活函数 --吴恩达

深度学习激活函数详解 一、核心作用 引入非线性:使神经网络可学习复杂模式控制输出范围:如Sigmoid将输出限制在(0,1)梯度传递:影响反向传播的稳定性二、常见类型及数学表达 Sigmoid σ ( x ) = 1 1 +...

保姆级教程:在无网络无显卡的Windows电脑的vscode本地部署deepseek

文章目录 1 前言2 部署流程2.1 准备工作2.2 Ollama2.2.1 使用有网络的电脑下载Ollama2.2.2 安装Ollama&#xff08;有网络的电脑&#xff09;2.2.3 安装Ollama&#xff08;无网络的电脑&#xff09;2.2.4 安装验证2.2.5 修改大模型安装位置2.2.6 下载Deepseek模型 2.3 将deepse…...

使用Spring AI和MCP协议构建图片搜索服务

目录 使用Spring AI和MCP协议构建图片搜索服务 引言 技术栈概览 项目架构设计 架构图 服务端开发 1. 创建Spring Boot项目 2. 实现图片搜索工具 3. 配置传输模式 Stdio模式&#xff08;本地调用&#xff09; SSE模式&#xff08;远程调用&#xff09; 4. 注册工具提…...

人机融合智能 | “人智交互”跨学科新领域

本文系统地提出基于“以人为中心AI(HCAI)”理念的人-人工智能交互(人智交互)这一跨学科新领域及框架,定义人智交互领域的理念、基本理论和关键问题、方法、开发流程和参与团队等,阐述提出人智交互新领域的意义。然后,提出人智交互研究的三种新范式取向以及它们的意义。最后,总结…...

在RK3588上搭建ROS1环境:创建节点与数据可视化实战指南

在RK3588上搭建ROS1环境:创建节点与数据可视化实战指南 背景介绍完整操作步骤1. 创建Docker容器环境2. 验证GUI显示功能3. 安装ROS Noetic4. 配置环境变量5. 创建ROS节点(小球运动模拟)6. 配置RVIZ默认视图7. 创建启动脚本8. 运行可视化系统效果展示与交互技术解析ROS节点通…...