git github初使用

##协作

#协作
$ git clone https://github.com/wing21/testfile.git #http地址
$ cd testfile
$ mkdir anewfile
$ git add anewfile
$ git commit -m "anewfile"
$ git branch -M main #当前本地分支名称修改为main
$ git push -u origin main

##独自创建

git init
git add .
git commit -m "first all"
git remote add origin git@github.com:wying21/testfile.git
git push -u origin main
git remote add wy git@github.com:wying21/secondfile.git # ssh 地址
git remote #列出所有远端仓库名字 origin & wy
git remote remove wy #删除wy对应的远端仓库
git remote

1.分支是文件夹。文件夹并列则分支并列。文件夹包含则分支包含。
2.git push pull 都得指定仓库origin指定分支main。不指定的话则在当前所对应的分支上。
3.ssh公钥

ssh -keygen
#连按两个enter键生成公钥
cd ~/   #回到根目录
cd .ssh/
cat id_rsa.pub #查看公钥内容,粘贴到GitHub的settings的ssh新添上。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值