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

【协议篇: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( …

【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;许多人…

VSCode调试C++

1、环境准备 1.1、g的安装与使用 1.1.1、安装 方式一&#xff1a;Xcode安装 苹果的开发集成工具是Xcode.app&#xff0c;其中包含一堆命令行工具。 在 App store 可以看到其大小有好几个G&#xff0c;有点大。 方式二&#xff1a;Command Line Tools 安装 Command Line Too…

03 Python进阶:MySQL - mysql-connector

mysql-connector安装 要在 Python 中使用 MySQL 数据库&#xff0c;你需要安装 MySQL 官方提供的 MySQL Connector/Python。下面是安装 MySQL Connector/Python 的步骤&#xff1a; 首先&#xff0c;确保你已经安装了 Python&#xff0c;如果没有安装&#xff0c;可以在 Python…

从零到一:基于 K3s 快速搭建本地化 kubeflow AI 机器学习平台

背景 Kubeflow 是一种开源的 Kubernetes 原生框架&#xff0c;可用于开发、管理和运行机器学习工作负载&#xff0c;支持诸如 PyTorch、TensorFlow 等众多优秀的机器学习框架&#xff0c;本文介绍如何在 Mac 上搭建本地化的 kubeflow 机器学习平台。 注意&#xff1a;本文以 …

js表达式

js 数据&#xff1a; 字面量 1 123 变量 a 表达式 12 2*2 a&&b 表达式都会有一个返回结果。表达式仍然是数据&#xff0c;所有可以写字面量&#xff0c;变量的地方都可以写表达式 在JavaScript中&#xff0c;表达式中的运算符具有不同的优先级&#xff0c;这决定…

【.NET全栈】ZedGraph图表库的介绍和应用

文章目录 一、ZedGraph介绍ZedGraph的特点ZedGraph的缺点使用注意事项 二、ZedGraph官网三、ZedGraph的应用四、ZedGraph的高端应用五、、总结 一、ZedGraph介绍 ZedGraph 是一个用于绘制图表和图形的开源.NET图表库。它提供了丰富的功能和灵活性&#xff0c;可以用于创建各种…

国外媒体推广软文宣发:促进海外宣发新风尚,迈向国际舞台

大舍传媒http://www.dashemeijie.com 序言 伴随全球经济一体化发展趋向&#xff0c;越来越多的中国企业希望在国际舞台上表现自己的总体水平。而国外媒体软文发稿作为一种全新的海外宣传方式&#xff0c;正逐渐成为促进海外宣发新风尚的主要常用工具。接下来我们就探讨国外媒…