温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Linux命令行下使用GitHub的方法

发布时间:2022-04-21 14:02:32 来源:亿速云 阅读:283 作者:iii 栏目:大数据

今天小编给大家分享一下Linux命令行下使用GitHub的方法的相关知识点,内容详细,逻辑清晰,相信大部分人都还太了解这方面的知识,所以分享这篇文章给大家参考一下,希望大家阅读完这篇文章后有所收获,下面我们一起来了解一下吧。

1.注册github账号

2.创建ssh密钥

cd ~

ssh-keygen -t rsa -C your_email@example.com

会在~/.ssh/下生成id_rsa.pub文件,在github网站上的SSH and GPG keys —

>New SSH Keys,标题随便写,可以写计算机的名字,将id_rsa.pub里面的内容

粘贴key里,最后点击Add SSH Key。

3.打开终端

ssh -T git@github.com

这一步如果提示Permission denied (publickey),就执行ssh-keygen -t rsa

-b 4096 -C "your_email@example.com"重新产生key,出现一下提示,说明以正

常连接到github

Hi ganchunsheng! You've successfully authenticated, but GitHub does

not provide shell access.

4.在github上创建仓库

上传代码按照这个步骤:

git init #初始化

git add . #初始化本地仓库

git commit -m "first commit" #加注释,并提交到本地仓库

git remote add origin https://github.com/xxxx/test.git #连接远程仓库

git push -u origin master #将本地仓库的东西提交到master分支下

5.下载代码

master分支:

git clone https://github.com/xxxx/test.git #xxxx为用户名

包含子分支:

git clone --recursive https://github.com/xxxx/test.git

6.常见问题

(1)提示错误:fatal: remote origin already exists.解决办法:

git remote rm origin

(2)git未初始化

***Please tell me who you are.

Run

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

解决办法:

git config --global user.name "your_email"

config --global user.email your_email@example.com

以上就是“Linux命令行下使用GitHub的方法”这篇文章的所有内容,感谢各位的阅读!相信大家阅读完这篇文章都有很大的收获,小编每天都会为大家更新不同的知识,如果还想学习更多的知识,请关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI