如何在github上发布一个开源项目

参考网址:https://help.github.com/

1、在github上注册一个帐户,并登录


2、安装和配置git

sudo apt-get install git-core

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

git config --global user.email "your_email@example.com"   //这里的email地址应该与你登录github的email账户地址保持一致

git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'


3、Generating SSH Keys (https://help.github.com/articles/generating-ssh-keys)
ssh-keygen -t rsa -C "your_email@example.com"  //这里的email地址应该与你登录github的email账户地址保持一致
ssh-add ~/.ssh/id_rsa
成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的 key。
回到github,进入Account Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴key

验证是否成功:
ssh -T git@github.com


4、在github上创建一个新的repository


5、初始化本地Repository

mkdir ~/YourRepositoryName

cd ~/YourRepositoryName
git init

touch README

git add README

git commit -m 'first commit'


6、将本地Repository连接到远程github上对应的Repository

git remote add origin https://github.com/yourName/YourRepositoryName.git

git push origin master
若出现:

error: The requested URL returned error: 403 while accessing https://github.com/yourName/YourRepositoryName.git/info/refs
fatal: HTTP request failed

git remote set-url origin ssh://git@github.com/yourName/YourRepositoryName.git
git push origin master


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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值