初次在 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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/791007.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【.NET全栈】.NET全栈学习路线

一、微软官方C#学习 https://learn.microsoft.com/zh-cn/dotnet/csharp/tour-of-csharp/ C#中的数据类型 二、2021 ASP.NET Core 开发者路线图 GitHub地址&#xff1a;https://github.com/MoienTajik/AspNetCore-Developer-Roadmap/blob/master/ReadMe.zh-Hans.md 三、路线…

把标注数据导入到知识图谱

文章目录 简介数据导入Doccano标注数据&#xff0c;导入到Neo4j寻求帮助 简介 团队成员使用 Doccano 标注了一些数据&#xff0c;包括 命名实体识别、关系和文本分类 的标注的数据&#xff1b; 工作步骤如下&#xff1a; 首先将标注数据导入到Doccano&#xff0c;查看一下标注…

Idea2023创建Servlet项目

① Java EE 只是一个抽象的规范&#xff0c;具体实现称为应用服务器。 ② Java EE 只需要两个包 jsp-api.jar 和 servlet-api.jar&#xff0c;而这两个包是没有官方版本的。也就是说&#xff0c;Java 没有提供这两个包&#xff0c;只提供了一个规范。那么这两个包是谁提供的…

逻辑回归(Logistic Regression)详解

逻辑回归&#xff08;Logistic Regression&#xff09;是一种常用的统计学习方法&#xff0c;用于解决二分类问题。虽然名字中包含“回归”&#xff0c;但逻辑回归实际上是一种分类算法&#xff0c;而不是回归算法。它的基本原理是使用逻辑函数&#xff08;也称为Sigmoid函数&a…

【TI毫米波雷达】IWR6843AOP的官方文件资源名称BUG,选择xwr68xx还是xwr64xx,及需要注意的问题

【TI毫米波雷达】IWR6843AOP的官方文件资源名称BUG&#xff0c;选择xwr68xx还是xwr64xx&#xff0c;及需要注意的问题 文章目录 demo工程out_of_box文件调试bin文件名称需要注意的问题附录&#xff1a;结构框架雷达基本原理叙述雷达天线排列位置芯片框架Demo工程功能CCS工程导…

大模型学习笔记八:手撕AutoGPT

文章目录 一、功能需求二、演示用例三、核心模块流程图四、代码分析1&#xff09;Agent类目录创建智能体对象2&#xff09;开始主流程3&#xff09;在prompt的main目录输入主prompt和最后prompt4&#xff09;增加实际的工具集tools&#xff08;也就是函数&#xff09;5&#xf…

通过TCP或UDP向某个IP和端口发送数据

工具发送 如果您想要一个简单的方法来发送TCP或UDP数据&#xff0c;可以尝试使用nc&#xff08;netcat&#xff09;命令。这是一个功能强大的网络工具&#xff0c;可以用于读取和写入数据流。 发送TCP数据 在命令行中运行以下命令&#xff1a; echo "Hello, World\!&q…

使用 Node.js + Express + MongoDB 构建的简单的增删改查

Node.js 和 Express 构建的简单的增删改查 Node.js 和 Express 构建的简单的增删改查步骤 1: 设置项目步骤 2: 创建服务器和路由步骤 3: 运行服务器注意如何使用数据库来持久化数据步骤 1: 选择数据库步骤 2: 安装数据库步骤 3: 连接数据库示例: 使用 Node.js 和 MongoDB安装 M…

.NET 设计模式—单例模式(SingletonPattern)

简介 单例模式&#xff08;Singleton Pattern&#xff09;是一种常用的软件设计模式&#xff0c;该模式的主要目的是确保某一个类只有一个实例存在。当你希望在整个系统中&#xff0c;某个类只能出现一个实例时&#xff0c;单例对象就非常适合。 优点 单例模式可以保证在全局…

【协议篇:Http与Https】

1. Http 1.1 Http的定义 超文本传输协议&#xff08;Hypertext Transfer Protocol&#xff0c;HTTP&#xff09;是用于分布式、协作式和超媒体信息系统的应用层协议。它是互联网上最广泛应用的数据通信协议之一&#xff0c;尤其对于万维网&#xff08;WWW&#xff09;服务而言…

docker容器技术篇:Docker API配置与常用操作

docker容器技术篇&#xff1a;Docker API配置与使用 一、API具体是什么&#xff1f; 百科解释应用程序接口&#xff08;API&#xff09;&#xff0c;又称为应用编程接口&#xff0c;就是软件系统不同组成部分衔接的约定&#xff0c;蒙了吧&#xff01;&#xff01;&#xff0…

C语言要点细细梳理(上)

1.类型转换 1.1 隐式类型转换 在两个不同类型数据进行运算时&#xff0c;会把低精度类型的数据转为与高精度类型一致的数据类型然后计算&#xff0c;然后再根据赋值的需要把计算结果转回去 1.2 强制类型转换 可以将某种类型的数据转换为想要的精度&#xff0c;一般int、dou…

Postman和Python Request测试多行Form-data

1、请求参数有多个&#xff0c;F12查看请求体如下&#xff1a; 查看源代码&#xff1a; ------WebKitFormBoundaryHknGXm9VkhRUXZYC Content-Disposition: form-data; name"custId"IICON004 ------WebKitFormBoundaryHknGXm9VkhRUXZYC Content-Disposition: form-da…

java数据结构与算法刷题-----LeetCode417. 太平洋大西洋水流问题

java数据结构与算法刷题目录&#xff08;剑指Offer、LeetCode、ACM&#xff09;-----主目录-----持续更新(进不去说明我没写完)&#xff1a;https://blog.csdn.net/grd_java/article/details/123063846 文章目录 深度优先遍历 深度优先遍历 解题思路&#xff1a;时间复杂度O( …

JavaWeb基础(计网 socket 数据库 JDBC lombok Mybatis JUnit Maven)

本文用于检验学习效果&#xff0c;忘记知识就去文末的链接复习 1. 网络基础 1.1 计网基础 区分设备&#xff1a;IP地址 区分网络&#xff1a;网络地址 网络互联&#xff1a;路由器 主机上进程间通信&#xff1a;端口 http是常用的协议&#xff0c;基于TCP协议 TCP VS U…

【Pt】马灯贴图绘制过程 04-玻璃脏迹

目录 效果 步骤 一、透明玻璃 二、烟熏痕迹 三、粗糙 四、浮尘 效果 步骤 一、透明玻璃 1. 打开纹理集设置&#xff0c;着色器链接选择“新的着色器链接” 在着色器设置中可以看到此时名称为“Main shader &#xff08;Copy&#xff09;” 这里修改名称为“玻璃” 在…

非关系型数据库-----------Redis的主从复制、哨兵模式

目录 一、redis群集有三种模式 1.1主从复制、哨兵、集群的区别 1.1.1主从复制 1.1.2哨兵 1.1.3集群 二、主从复制 2.1主从复制概述 2.2主从复制的作用 ①数据冗余 ②故障恢复 ③负载均衡 ④高可用基石 2.3主从复制流程 2.4搭建redis主从复制 2.4.1环境准备 2.4…

文件夹0字节:数据恢复全攻略与防范之道

在日常使用电脑或移动设备的过程中&#xff0c;我们经常会遇到各种各样的问题&#xff0c;其中文件夹突然变为0字节的情况尤为令人头疼。这种情况通常意味着原本存储着重要文件的文件夹突然变得空空如也&#xff0c;文件大小显示为0字节。面对这样的数据灾难&#xff0c;许多人…

速盾:服务器有cdn 带宽上限建议多少

CDN&#xff08;内容传输网络&#xff09;是一种通过分布在全球不同地点的服务器来提供高效内容分发的技术。当用户请求访问某个网站时&#xff0c;CDN会根据用户的地理位置&#xff0c;将内容从离用户最近的服务器上提供给用户&#xff0c;这样可以减少延迟和带宽消耗&#xf…

MySQL中日期有关函数

本次记录了获取日期时间的多种方式&#xff0c;还有日期和字符串之间的转换&#xff0c;以及加减日期的操作。 获取时间 # 1.获取当前时间(年月日时分秒格式) select now();# 2.获取当前时间(年月日格式) select curdate();# 3.获取当前时间(时分秒格式) select curtime();# 4.…