zoukankan      html  css  js  c++  java
  • Atitit.软件gui按钮and面板---通讯子系统(区)-- github 的使用....

    Atitit.软件gui按钮and面板---通讯子系统()-- github 的使用....

    1. 1.注册账户以及创建仓库 1

    2. 二.GitHub中创建项目(create a new repo)。 1

    3. windows下安装Git 2

    3.1. 安装客户端msysgit 3

    4. .配置Git  ssh key 3

    4.1.  3

    5. 对库进行clone,如下:  git clone https://github.com/xrong/xxxx.git    xxx为项目仓库名称) 4

    6. 3.上传代码项目到GitHub4

    1. 1.注册账户以及创建仓库

    要想使用github第一步当然是注册github账号了。之后就可以创建仓库了(免费用户只能建公共仓库),Create a New Repository,填好名称后Create,之后会出现一些仓库的配置信息,这也是一个git的简单教程。

    作者:: 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

    转载请注明来源: http://blog.csdn.net/attilax

    2. 二.GitHub中创建项目(create a new repo)。 

    登陆GitHub页面,在右上角点击create a new repo按钮,如下图,输入相关信息后点击create repository后完成创建项目。 

    然后页面就会跳转到repo下面,在地址栏中会看到 https://github.com/xrong/xxxxx.git  这个就是你这个项目的地址了(xxxx为你的项目名称)。 

    3. windows下安装Git

    可以到这个网站下载安装 http://windows.github.com/

    3.1. 安装客户端msysgit

    github是服务端,要想在自己电脑上使用git我们还需要一个git客户端,我这里选用msysgit,这个只是提供了git的核心功能,而且是基于命令行的。如果想要图形界面的话只要在msysgit的基础上安装TortoiseGit即可。

    装完msysgit后右键鼠标会多出一些选项来,在本地仓库里右键选择Git Init Here,会多出来一个.git文件夹,这就表示本地git创建成功。右键Git Bash进入git命令行,为了把本地的仓库传到github,还需要配置ssh key

    4. .配置Git  ssh key

    4.1.  

    首先在本地创建ssh key

    1

    $ ssh-keygen -t rsa -C "your_email@youremail.com"

    后面的your_email@youremail.com改为你的邮箱,之后会要求确认路径和输入密码,我们这使用默认的一路回车就行。成功的话会在~/下生成.ssh文件夹,进去,打开id_rsa.pub,复制里面的key

    回到github,进入Account Settings,左边选择SSH KeysAdd SSH Key,title随便填,粘贴key。为了验证是否成功,在git bash下输入:

    1

    $ ssh -T git@github.com

    如果是第一次的会提示是否continue,输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github

    接下来我们要做的就是把本地仓库传到github上去,在此之前还需要设置usernameemail,因为github每次commit都会记录他们。

    1

    2

    $ git config --global user.name "your name"

    5. 对库进行clone,如下: 
    git clone https://github.com/xrong/xxxx.git    xxx为项目仓库名称) 

    6. 3.上传代码项目到GitHub 

      

    git add . 

    一般如果你想分享这个文件夹里的所有代码,就在 add后面加“.”,上面的例子就是这样,如果传指定的,只需要把“.”改为文件名即可,现在只是选择了要加入仓库的文件,下面才是添加进入仓库: 

    git commit -m 'first_commit' 

    -m后面跟一个参数,表示说明,将代码提交到GitHub后,将会在代码文件信息上显示这个说明 

    git remote add origin https://github.com/xrong/xxxx.git 

    git remote add name url 在url创建名字为name的远端仓库(Adds a remote named <name> for the repository at <url>) 
    name为远程仓库的名字 

    git push origin master 

     提交本地origin分支作为远程的master分支 

    如果执行git remote add origin https://github.com/xrong/xxxx.git ,出现错误: 

    fatal: remote origin already exists 

    则执行以下语句: 

    git remote rm origin 

      

    需要移除对应的远端仓库 

      

    再往后执行git remote add origin https://github.com/xrong/xxxx.git 即可。 

    在执行git push origin master时,报错: 

    error:failed to push som refs to....... 

    则执行以下语句: 

    git pull origin master 
    git pull:相当于是从远程获取最新版本并merge到本地 
    上述命令其实相当于git fetch 和 git merge 
    在实际使用中,git fetch更安全一些,先把远程服务器github上面的文件拉先来,再push 上去。 

    7. Git的缺点

    每时间都要username,pwd 每提交的时候儿...麻烦的..

    8. 参考

    如何使用githubgithub简单使用教程(转)_洋柿子炒青椒_新浪博客.htm

    GitHub当道,菜鸟也为Git疯狂 推酷.htm

    Git错误non-fast-forward后的冲突解决 - chain - 努力がゆえに淋しく、孤独がゆえに強くなる 博客频道 - CSDN.NET.htm

  • 相关阅读:
    单例模式
    json 格式
    axios 获取不到数据错误
    sprint test 添加事务回滚机制
    springboot An incompatible version [1.1.32] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
    spring boot 启动之后404
    废了
    tomcat 部署项目到服务器
    Druid 介绍及配置
    jq 全选
  • 原文地址:https://www.cnblogs.com/attilax/p/5963797.html
Copyright © 2011-2022 走看看