github 在ubuntu上使用入门

首先注册一个github帐号,然后create a new repository,随便娶个名字.,如customtitlebar.

然后在ubuntu终端下安装git:

sudo apt-get install git

然后git初始设置:

git config --global user.name "pythonsoft"       #你的github用户名

git config --global user.email pythonisfun@gmail.com  #你注册github所使用的邮箱

然后初始化git仓库:

cd /workspace      #切换到你的工作目录,随意

git init

git add project      #添加你想要上传的工程或文件到git 仓库

添加必要的说明文件README.md,介绍你的工程:

echo "#custom title bar" >> README.md

git add README.md

然后提交

git commit -m "简要说明:比如修改了什么bug"

然后上传仓库:

git remote add origin https://github.com/pythonsoft/customtitlebar.git       #上传的url路径,后面跟的是 用户名/repository.git

git push -u origin master

根据提示输入用户名,密码,等一会儿就上传成功。打开你的github,你会看到文件已经上传了.

如果你使用了代理,可能会遇到下面的错误:

steven@steven-OptiPlex-330:/$ git push -u origin master
error: The requested URL returned error: 407 while accessing https://github.com/pythonsoft/customtitlebar.git/info/refs
fatal: HTTP request failed
steven@steven-OptiPlex-330:/$ sudo gedit .git/config
编辑 .git/config文件添加代理:

[http]
        proxy = http://user:pass@ip_or_host:port
[https]
        proxy = http://user:pass@ip_or_host:port
保存后,重新执行
git push -u origin master
即可.




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值