zoukankan      html  css  js  c++  java
  • 【在家办公】代码上传公司远端GitLab仓库

    【在家办公】代码上传公司远端GitLab仓库


    查看本地的git 如何添加远程仓库

    1.查看远程仓库地址

    git remote -v
    

    此时若什么都没有显示说明,git无远程仓库。


    2.添加ssh协议的远程仓库

     git remote add origin git@github.com:**********.git
    

    再次查看,即可查看到2个远程仓库的链接

    origin	git@gitlab.com:**********.git (fetch)
    origin	git@gitlab.com::**********.git (push)
    

    当前,我本机就是用的这种方式连接的github,好处是每次提交代码时,不需要重复来回输入用户名和密码,这就是ssh秘钥的好处。


    使用家里的WiFi长传到github上的代码时,报出如下错误:

    $ git push origin 分支名称
    ssh: connect to host github.com port 22: Connection refused
    fatal: Could not read from remote repository.
    

    得知第一种协议被禁掉后,只能换一种连接进行合并本地仓库了。继续往下看另一种协议。


    3.切换成 https协议连接github

    建立本地仓库和远端GitLab仓库的关联关系

    git remote add origin  https://gitlab*********************.git
    

    在这一步时如果出现错误:fatal:remote origin already exists先清除一下关联关系:

    git remote rm origin
    

    再重新关联:

    git remote add origin  https://gitlab*********************.git
    

    检查关联是否已建立且正确

    git remote -v
    

    注意:因为我们是在家办公,我们公司的gitlab域名映射成了ip我们直接把`域名换成IP地址`
    # 添加http链接协议
    git remote add origin http://ip:port/*********************.git
    

    参考链接:https://blog.csdn.net/s740556472/article/details/80318886

    https://www.jianshu.com/p/c74ae40b5127

    从小白到大神的蜕变~~
  • 相关阅读:
    maven
    in 和 or 的效率问题
    mac 安装homobrew 报错解决
    卷积的本质及物理意义
    java 多线程 day18 ThreadPoolExecutor
    打jar包
    科三保佑贴
    【问题解决】-《java.lang.NoClassDefFoundException》
    POS-商户手续费-从生活剖析,通俗易懂
    关于荒废空闲时光的思考
  • 原文地址:https://www.cnblogs.com/tjw-bk/p/14686027.html
Copyright © 2011-2022 走看看