在Linux上如何使用GitHub

  • Post author:
  • Post category:linux




1.安装git


安装指令

yum install git


查看安装是否成功和git版本

git --version



2.使用Githup创建项目

在这里插入图片描述


完成后保存项目链接


在这里插入图片描述



3.下载项目到本地仓库

git clone  [url] //这里的url为上一步保存的项目链接



4.创建ssh密钥

ssh-keygen -t rsa -C your_email@你的邮箱

然后一直回车 直到创建完成。



5.使用 git add 将要上传的代码放入刚才下载好的目录中。

git add [文件名]



6.使用git commit 将代码提交到本地

git commit . // "."表示当前目录

在这里建议大家在提交的时候注明提交日志!!!



7.git push 将代码同步到远端的Githup上。

git push



使用时常见问题、


1. 在使用 git push 后提示错误为:


No refs in common and none specified; doing nothing.

Perhaps you should specify a branch such as ‘master’.

Everything up-to-date


解决方案:

git push origin master


2 提示错误:fatal: remote origin already exists.



解决方法:

git remote rm origin


3 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"


感谢大家的参考,希望可以帮助到大家(


__


) !



版权声明:本文为weixin_43730061原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。