zoukankan      html  css  js  c++  java
  • windows下使用git管理github项目

    1. 下载安装msysgit
    http://code.google.com/p/msysgit/downloads/list
    2. 注册github账号
    3. 生成ssh公钥和私钥
    ssh-keygen -C “zhoujiangbohai@163.com” -t rsa
    记住ssh-keygen两者之间没有空格,会生成id_rsa和id_rsa.pub文件,记住备份生成的公钥和私钥,这个可以在多台电脑共用的。
    登录github,点击Account Settings-》SSH keys-》Add SSH key,title随便取,打开id_rsa.pub文件,把内容粘贴到key里去。
    测试连接是否成功,在git bash中执行以下命令:
    ssh -T git@github.com
    如果没有被墙,应该是没有问题的,如果出现22或者443端口无法连接,那就继续google,设置代理,因为我家里电脑没有碰到,这里就不啰嗦了。正常效果如图:

    4. 在github主页创建一个项目(HelloWorld),点击New。

    5. 在本地创建一个相同名称的项目(HelloWorld)
    $ mkdir ~/HelloWorld
    $ cd ~/ HelloWorld
    $ git init //初始化
    $ touch README
    $ git add README //添加README文件到内存
    $ git commit -m ‘first commit’//提交到本地仓库
    //git remote add [shortname] [url]:添加远程仓库,指定远程仓库名字为origin
    $ git remote add origin git@github.com:zhoujianghai/ HelloWorld .git
    //提交到远程仓库的master分支
    $ git push -u origin master
    git remote add [shortname] [url]
    OK,现在登录github,应该可以看到提交上去的README文件了。

    记得每次push前,最好先拉取一下最新的代码:
    git pull origin master

    执行 git remote add [shortname] [url] 如果提示:remote origin already exists.
    则先删除:git remote rm origin
    然后再添加:git remote add origin git@github.com:zhoujianghai/HelloWorld .git

  • 相关阅读:
    13.App爬取相关库的安装(Charles,Mitmproxy,Appium)
    26.pymysql、pymongo、redis-py安装
    25.安装配置phantomjs
    2.博客随笔加密!!!
    17.scrapy-splash安装-2
    17.docker及scrapy-splash安装-1
    16.Mongodb安装
    scrapy--BeautifulSoup
    scrapy--selenium
    python--随笔一
  • 原文地址:https://www.cnblogs.com/senior-engineer/p/4497420.html
Copyright © 2011-2022 走看看