Using VSCode git extensition to access Gitee on CentOS 7

本教程指导如何在CentOS7上将Git从1.8升级到2.x,以满足VSCode扩展对Git版本的要求。首先卸载旧版Git,然后安装EndpointDev的Git2.x。接着创建SSH密钥以验证Gitee身份,设置Git的用户名和邮箱。通过设置credential.helper避免频繁输入密码。最后,克隆Gitee项目到本地,并使用VSCode编辑代码。
摘要由CSDN通过智能技术生成

CentOS 7 is an old Linux. The version of git on it is 1.8
However, vscode git extension expects git >2.0.

step 1. upgrade git 1.8 to git 2.x.  because VSCode likes git >2.0
   follwing the instruction of https://www.endpointdev.com/blog/2021/12/installing-git-2-on-centos-7/
   
   # remove old git 1.8
   sudo yum remove git
   sudo yum remove git-*
   
   # install latest git 2.x
   sudo yum install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm
   sudo yum install git

step 2. create ssh key. It makes gitee recognize me.
 following the instaruction of

【教程】在VSCode中使用码云进行代码管理.md · watfe/Public - Gitee.com


    ssh-keygen -t rsa -C "youremail@xxx.com"
    cat ~/.ssh/id_rsa.pub
    Open the SSH public key manager page:   https://gitee.com/profile/sshkeys
    Fill the title:   yourname's SSH key
    public key:   the content of ~/.ssh/id_rsa.pub
    push the button of "add"
    Then you can test your connection to gitee using next command in a terminal.
    ssh -T git@gitee.com
    if everything goes well, you wil get the info
    # Welcome to Gitee.com, YourGiteeName

step 3.  save your user name and user.email to your git config.
    git config --global user.name yourname
    git config --global user.email youremail@xxx.com

step 4. let git remeber you so that not ask your password frequently.
    git config --global credential.helper store
    
step 5. clone your project from gitee to local in a terminal
    git clone https://gitee.com/YourGiteeName/project.git   your_local_path
    You may get the project.git url from the project webpage on gitee.com
    You may asked to provide the password.  Only one time is neccessary for you
    to provide the password. After that, git will connect gitee without asking you
    for the password anymore.
    
step 6. install vscode and

step 7. use vscode "open folder" to open your_local_project_path.
        Then you can edit your source code. The git extension in vscode can track the modification.
        You can commit, push, pull your project files with git extension in vscode.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值