github cli 创建远程仓库并推送到github

2023-05-16

以下操作基于macOS,其他系统安装请参阅官方文档cli/cli: GitHub’s official command line tool。

1. 安装github cli

brew install gh

2. 登录

以下操作步骤基本上就是上下方向键进行选择,然后回车。Token需要访问这里手动创建并粘贴。Token的权限应该至少包括repo, read:org, admin:public_key.

# 输入登录命令
gh auth login
# 选择登录网站GitHub.com
? What account do you want to log into?  -> GitHub.com
# 选择协议,我选SSH
? What is your preferred protocol for Git operations?  -> SSH
# 选择并上传上传SSH public key
? Upload your SSH public key to your GitHub account?  -> /Users/simonliu/.ssh/id_rsa.pub
# 设置key的title
? Title for your SSH key:  -> GitHub CLI
# 选择认证方式,我这里选token
? How would you like to authenticate GitHub CLI?  ->Paste an authentication token
Tip: you can generate a Personal Access Token here https://github.com/settings/tokens
The minimum required scopes are 'repo', 'read:org', 'admin:public_key'.
? Paste your authentication token: ****************************************
- gh config set -h github.com git_protocol ssh
✓ Configured git protocol
✓ Authentication complete.

3. 在本地仓库文件夹创建远程仓库并推送到服务器

基本上就是输入 gh repo create然后一路根据提示操作即可。

# 3.1 创建远程 repository
gh repo create
# 3.2 输入本地仓库路径,默认是当前路径 .
? Path to local repository -> .
# 3.3 选择行为:推送本地仓库至github
? What would you like to do? -> Push an existing local repository to GitHub
# 3.4 设置仓库名称,注意不要使用中文,否则中文字符会被替换为英文破折号
? Repository name -> epub_convert_tool
# 3.5 输入描述
? Description -> epub转换工具
# 3.5 选择可见度
? Visibility -> Private
✓ Created repository simonliu009/epub_convert_tool on GitHub
# 3.6 为本地仓库增加remote
? Add a remote? -> Yes
# 3.7 设置remote名称
? What should the new remote be called? -> origin
✓ Added remote git@github.com:simonliu009/epub_convert_tool.git
# 3.8 是否将当前分支的提交推送到origin,选择Yes
? Would you like to push commits from the current branch to "origin"?  ->Yes
Warning: Permanently added 'github.com,20.205.243.166' (ECDSA) to the list of known hosts.
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 3.61 KiB | 3.61 MiB/s, done.
Total 5 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:simonliu009/epub_convert_tool.git
* [new branch]      HEAD -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
✓ Pushed commits to git@github.com:simonliu009/epub_convert_tool.git

4. 其他gh命令

gh repo --help
Work with GitHub repositories.

USAGE
  gh repo <command> [flags]

GENERAL COMMANDS
  create:      Create a new repository
  list:        List repositories owned by user or organization

TARGETED COMMANDS
  archive:     Archive a repository
  clone:       Clone a repository locally
  delete:      Delete a repository
  deploy-key:  Manage deploy keys in a repository
  edit:        Edit repository settings
  fork:        Create a fork of a repository
  rename:      Rename a repository
  set-default: Configure default repository for this directory
  sync:        Sync a repository
  unarchive:   Unarchive a repository
  view:        View a repository

INHERITED FLAGS
  --help   Show help for command

ARGUMENTS
  A repository can be supplied as an argument in any of the following formats:
  - "OWNER/REPO"
  - by URL, e.g. "https://github.com/OWNER/REPO"

EXAMPLES
  $ gh repo create
  $ gh repo clone cli/cli
  $ gh repo view --web

LEARN MORE
  Use 'gh <command> <subcommand> --help' for more information about a command.
  Read the manual at https://cli.github.com/manual
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

github cli 创建远程仓库并推送到github 的相关文章

  • Redis集群常用命令及说明

    一 集群的特点 1 集群架构特点 xff08 1 xff09 所有的redis节点彼此互联 xff08 PING PONG机制 xff09 xff0c 内部使用二进制协议优化传输速度和带宽 xff1b xff08 2 xff09 节点的fa
  • 电脑出现bootmgr is conmpressed的解决方法

    产生原因 xff1a 用户查看到自己C盘空间不足 xff0c 使用第三方软件进行磁盘压缩 主机重启之后无法通过开机检测 xff0c 会出现bootmgr is conmpressed提示 解决方法 xff1a 1 使用系统光盘或者U盘启动盘
  • Win7 旗舰版改为专业版 一键脚本执行(不用重装)

    方法一 xff1a 手动复制文件覆盖 1 到任意一台Win7专业版系统拷贝文件夹Branding 文件夹路径 xff1a C Windows Branding 2 Win7旗舰版主机修改前状态信息 3 查看文件basebrd dll mui
  • Blender 插件UvSquares

    目录 1 UvSquares插件1 1 解压UvSquares插件1 2 blender偏好设置1 3 打开插件1 4 安装插件1 5 勾选插件UvSquares1 6 安装UvSquares插件前1 7 安装UvSquares插件后 1
  • Blender 建模练习-锁链

    目录 1 1 1 贝塞尔圆1 2 阵列修改器1 3 阵列修改器 物体偏移1 4 添加贝塞尔曲线1 5 曲线修改器 1 本次练习主要使用到阵列修改器 贝塞尔曲线 空物体 1 1 贝塞尔圆 把贝塞尔圆进行缩放 xff0c 然后在物体数据属性 几
  • Blender 形变类修改器:曲线

    目录 形变类修改器1 测试一 xff1a 减少环切数量1 1 调整物体原点1 2 让两个物体原点重合1 3 添加曲线修改器1 4 融并边 2 测试二 xff1a 曲线的方向2 1 查看曲线的方向 xff08 曲线法向显示 xff09 2 2
  • Centos 普通用户su到root用户提示错误

    一 CentOS7 普通用户执行su时 xff0c 报如下错误 xff1a test 64 ecs 1453 su Password su Authentication failure 解决方法 xff1a 如果root能够正常登陆 xff
  • Windows Server2012 主副AD域控部署

    介绍 xff1a 部署主域控和辅域控 server2012跟server2008同样能够实现 部署额外域控制器 xff0c 指的是在域中部署第二个甚至更多的域控制器 xff0c 每个域控制器都拥有一个 Active Directory 数据
  • AD辅域控制器升级为主域控制器(图形界面操作)

    环境介绍 Active Directory域控制器已经搭建好主域控和辅域控 xff0c 主域控故障 xff0c 手动升级辅域控为主 主域控 xff1a 2012DC1 xff0c ip xff1a 192 168 15 1 辅域控 xff1
  • macOS的Chrome安装插件提示 程序包无效

    感谢 xff1a 完美解决Mac系统下Chrome插件安装时程序包无效 CRX HEADER INVALID 下载好插件crx文件后 xff0c 不要直接拖拽到扩展页面进行添加先把插件crx文件的后缀改成zip xff0c 再拖入到chro
  • Windows server 2008远程桌面会话主机和远程桌面授权(解决120天过期问题)

    一 系统环境 部署RemoteAPP是加入域控管理的 xff0c 这样可以方便授权管理 xff0c 域部署查看 xff1a https blog csdn net tladagio article details 80464833 二 远程
  • KMS激活报错0x8007000D

    一 错误显示 在执行kms的批处理激活office的时候 xff0c 显示报错 xff1a 0x8007000D 原因 xff1a 这台机器之前是使用其他KMS服务器序列号激活的系统 xff0c 现在使用批处理文件激活office的的KMS
  • win7无法访问局域网共享,错误代码0x80070043找不到网络名

    一 故障 xff1a win7无法访问局域网共享文件 xff0c ping网络正常 故障提示如图 类似错误代码还有可能是0x80070035 xff0c 提示找不到网络路径 二 解决 1 在控制面板找到网络连接 2 点击本地连接右键属性 3
  • 在github上搭建个人独立博客

    这篇文章会给大家分享利用github pages搭建我的个人独立博客的过程 xff0c 希望能帮助到一些想搭建独立博客的朋友 本文操作中所使用的操作系统为MacOS 一 工具准备 1 下载nodejs https nodejs org zh
  • hexo博客如何绑定个人域名

    我利用hexo在github上搭建了自己的独立博客 如果要打开这个博客 xff0c 我们则需要输入GitHub下的二级域名username github io xff0c 这里面的username就是你注册GitHub账户时的用户名 但是为
  • PX4的控制与输出

    文章目录 前言控制器部分输出部分控制组混控器混控器的启动信号输出 前言 这篇记录一下自己分析PX4从位置控制 gt 速度控制 gt 姿态控制 gt 角速度控制 gt 电机输出的源码框架的阅读与理解 xff0c 便于之后自己修改控制器 在这个
  • ML302 OpenCPU系列(5)---Log工具的使用

    ML302 OpenCPU系列 xff08 5 xff09 Log工具的使用 一 使用串口助手抓取Log二 使用Coolwatcher抓取AP Log三 查看死机现场 工欲善其事 xff0c 必先利其器 Log是嵌入式开发中最重要的调试手段
  • Lottie简单使用

    一 简介 Lottie 是Airbnb开源的一个面向 iOS Android React Native 的动画库 xff0c 能分析 Adobe After Effects 导出的动画 xff0c 并且能让原生 App 像使用静态素材一样使
  • Xshell显示图形化界面

    前言 很久没用过图形化界面了 xff0c 都忘记怎么使用了 依据以往的经验都是由环境变量DISPLAY设置 xff0c 然后就能连接了 xff0c 每天也是匆匆忙忙的就过了一天 xff0c 都不知道干了啥 xff0c 分配的时间也少 xff
  • 2017--就业分享之IT校招现状和面试经历

    在介绍自己整个春季和夏季实习求职经历之前 xff0c 先给大家公布一则新闻 2017届互联网校招薪酬报告 xff1a 先说下对 16 年 17 届校招的总体看法 xff1a 本该是个不大不小的年 xff0c 结果被华为一己之力搞成了个大年

随机推荐