CentOS7安装Git及代码的签入签出

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LuyaoYing001/article/details/79314627

在CentOS7环境下安装Git非常简单,根据以下步骤即可以在15分钟以内快速地搭建Git服务器,并掌握代码的签出以及签入。

  1. 确认是否已经安装Git
    rpm -qa git
  2. 安装Git
    yum install git
  3. 创建Git用户
    useradd [username]
    passwd [username],输入密码
  4. 创建Git代码仓库
    mkdir /data/git/[gitname]
    chown [username]:[username] [gitname]
    git init –bare [gitname]
    chown -R [username]:[username] [gitname]
  5. 克隆远程仓库
    cd /root/CLionProject
    git clone [username]@ip:/data/git/[gitname]
  6. 提交代码
    git add *
    git commit -m “your comment”
    git push origin master
  7. 提交Clion工程到Git代码仓库
    a. 菜单栏 VCS->Import into Version control-> Create Git Repository
    b. 右键工程,点击Git->Add
    c. 右键工程,点击Git->Repository->Remotes,在对话框中添加url
  8. 其他
    查看Git用户和邮箱
    git config user.name
    git config user.email
    修改Git用户和邮箱
    git config –global user.name [username]
    git config –global user.email [useremail]
    查看config属性
    git config –global –list
    删除config属性
    git config –global –unset user.name

猜你喜欢

转载自blog.csdn.net/LuyaoYing001/article/details/79314627