热点新闻
上传本地代码到github详解
2023-07-05 12:05  浏览:533  搜索引擎搜索“富博农业网”
温馨提示:信息一旦丢失不一定找得到,请务必收藏信息以备急用!本站所有信息均是注册会员发布如遇到侵权请联系文章中的联系方式或客服删除!
联系我时,请说明是在富博农业网看到的信息,谢谢。
展会发布 展会网站大全 报名观展合作 软文发布

一、(无github账号的)注册,登录github,创建repository,设置访问权限




image.png





image.png





image.png


复制https地址https://github.com/loveGithubs/test1

二、建立git仓库
2.1、cd到本地项目目录,执行git命令
git init
2.2、将项目的所有文件添加到仓库中
git add .
2.3、提交代码到仓库
git commit -m "commit code"
2.4、本地仓库关联github
git remote add origin https://github.com/loveGithubs/test1
注意:链接地址不要带.git,否则可能报错fatal: unable to access 'https://github.com/loveGithubs/test1.git/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
2.5、上传到git远程仓库
git push -u origin main
成功:




image.png

如遇到remote: Support for password authentication was removed on August 13, 2021,即密码凭证从2021年8月13日开始无法使用,必须用token的报错。解决方案:
1、登录自己的github账号,选择settings





image.png


2、选择developer settings





image.png


3、选择Personal access tokens和Generate new token



image.png


4、设置token的有效期,访问权限等

注意:要使用token从命令行访问仓库,请选择repo;要使用token从命令行删除仓库,请选择delete_repo





image.png


4.1、点击生成令牌 Generate token



image.png


5、复制token,粘贴到在push代码时要求输入密码的位置,push即可



image.png

发布人:82e0****    IP:117.173.06.***     举报/删稿
展会推荐
让朕来说2句
评论
收藏
点赞
转发