GitHub上传文件

GitHub上传文件

SSH keys配置

操作流程

  1. 首先用在Git Bash上输入 ~/.ssh
    如果电脑上,就会显示bash: /c/Users/…/.ssh: Is a directory
    如果电脑上没有,那就显示bash: /c/Users/…/.ssh: No such file or directory

  2. 第1步如果是没有,则在Git Bash中输入
    ssh-keygen -t rsa -C "邮箱"
    然后就会显示这两行:
    Generating public/private rsa key pair.
    Enter file in which to save the key (/c/Users/16627/.ssh/id_rsa):
    这里让你输入一个文件名,建议直接回车。后面会让你输入密码,在上传文件的时候会问你的密码。

  3. 添加SSH Key到GitHub
    . 首先打开Github网页,右上角头像处左键Setting,SSH and GPG keys。
    Title随便设置,Key则是第1步中.ssh文件夹中id_rsa.pub文件,复制粘贴上去即可。添加之后会有邮件提醒。

  4. 测试一下该SSH key
    在git Bash 中输入以下代码
    ssh -T git@github.com
    然后会提示你:
    The authenticity of host ‘github.com (13.229.188.59)’ can’t be established.
    RSA key fingerprint is SHA256:nThbg6kXUp…
    Are you sure you want to continue connecting (yes/no/[fingerprint])?
    输入yes,回车
    接下来就会提示你输入密码,如果上边设置ssh的时候,你没设置密码会提示你:
    Warning: Permanently added ‘github.com,192.30.255.112’ (RSA) to the list of known hosts.
    警告完了,如果你能看到如下提示,那你已经成功设置SSH密钥。
    Hi “用户名”! You’ve successfully authenticated, but GitHub does not provide shell access.
    如果你看到 access denied,者表示拒绝访问,那么你就需要使用 https 去访问。

参考

https://blog.csdn.net/qq_36667170/article/details/79094257

GitHub上传

上传文件

README.md
git init
git add README.md
git commit -m “first commit”
git branch -M main
git remote add origin git@github.com:#/##.git
git push -u origin main

上传文件夹

git init
git add *
git commit -m “first commit”
git remote add origin git@github.com:#/##.git
git push -u origin master

上传R包

git init
git add README.md
git add *
git commit -m “first commit”
git branch -M main
git remote add origin git@github.com:#/##.git
git push -u origin main

git init
git add *
git commit -m “first commit”
git remote add origin git@github.com:#/##.git
git push -u origin master

git init
git branch -M main
git remote add origin git@github.com:#/##.git
git branch -M main
git push -u origin main

注:#代表GitHub名,##代表仓名。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值