Github上传本地工程教程

1、拥有github账号

2、下载并安装gitbash

https://www.git-scm.com/download/win

安装方法为图形界面安装,选择好安装路径后,多选全选,单选默认。安装可以参考

https://blog.csdn.net/Jessieeeeeee/article/details/107892585?ops_request_misc=&request_id=&biz_id=102&utm_term=gitbush%E5%AE%89%E8%A3%85&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-4-107892585.142^v94^chatsearchT3_1&spm=1018.2226.3001.4187

(更多详细过程也可以参考此文,本文介绍在github上传工程的基本步骤,直接简单)

3、git bash使用

3.1 配置自己的github账户

在gitbash命令行输入

git config --global user.name "your name"

git config --global user.email "your@email.com"

3.2 创建SSHkey

ssh-keygen -t rsa -C "your@email.com"

点击多次回车,记住.ssh文件保存位置

打开.ssh文件夹,用记事本打开id_rsa.pub文件,复制其中的内容。并复制如下图所示的,key下面文本框里,title任意填,并点击add SSH key.

3.3 上传工程

  1、新建repository

  git clone https://github.com/Githuyou/transformer.git

2 、打开git bash

在克隆下来的文件下打开git bash,并在该文件夹下放入自己的工程文件

3、通过一些命令行,上传自己的工程

接下来依次输入

1、git init

2、git add <文件名> (git add . 添加所有)

3、git commit -m "描述性信息"

4、git remote add origin <repository-url> repository-url:https://github.com/Githuyou/transformer.git

git remote -v (查看当前repository-url)

git remote set-url origin <repository-url> (如果已有origin 要替换使用这个命令)

git remote set-url origin https://github.com/Githuyou/transformer.git

5、git push -u origin <branch-name> branch-name为当前分支名字,如main。

   推送更改内容到对应的github仓库对应分支里

通过git branch 可以查看当前有哪些分支,

git checkout -b <new-branch-name> 创建新分支,并切换

git checkout <branch-name> 切换到已存在分支

一个工程有多个分支允许,协作者共同开发一个项目,这是分支的一大作用

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值