Ubuntu9.10安装Git,Git 和Github初次使用

工作环境:Ubuntu9.10.github
A、Git安装
1、申请GitHub帐户 xxx ,创建名为new-project的新Repository 

2、安装Git客户端(Linux)
#sudo apt-get install git git-core 
果你已经安装好git那么通过下面命令来更新版本库。git clone git://git.kernel.org/pub/scm/git/git.git

3、 生成密钥对,这样项目可以push到 GitHub上
#ssh-keygen -t rsa -C "xxx@gmail.com"
4、将.ssh/id_rsa.pub拷贝到GitHub网站
5、修改~/etc/.ssh/ssh_config.
  PasswordAuthentication no  去掉#并把 yes改为NO
     HostbasedAuthentication no 去掉#
  IdentityFile ~/.ssh/identity 去掉#
     IdentityFile ~/.ssh/id_rsa 去掉#
                 IdentityFile ~/.ssh/id_dsa 去掉#
                 Port 22 去掉#
    Protocol 2,1 去掉#  
新增:
 Host github.com
 user git 
 Hostname github.com
 PreferredAuthentications publickey
 IdentityFile ~/.shh/id_rsa.pub  添加这个非常重要。

shell执行:ssh-add id_rsa,添加密钥。
6、执行 ssh git@github.com。或者 ssh -v git@github.com 可查看相应的链接debug的信息。
链接成功后:可以见到:Hi fuhao715! You've successfully authenticated, but GitHub does not provide shell access.
         debug1: channel 0: free: client-session, nchannels 1
Connection to github.com closed.
Transferred: sent 2544, received 2888 bytes, in 1.2 seconds
Bytes per second: sent 2065.4, received 2344.6
debug1: Exit status 1
7、Config用户名以及邮箱: git config --global user.name "Your Name"
     git config --global user.email fuhao-715@163.com
        
下一步:
   mkdir GoProject
cd GoProject
   git init
  touch README
   git add README
   git commit -m 'first commit'
  git remote add origin git@github.com:fuhao715/GoProject.git
  git push  origin master

# vi README  // 注解 新文件 直接vi保存后,需要git add文件,然后加入 git commit -m  再 git push  origin master

更新至远程
# git push origin master

转载于:https://my.oschina.net/fuhao715/blog/14413

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值