zoukankan      html  css  js  c++  java
  • gitlab上传代码及报错处理

    1、安装git    https://git-scm.com/downloads

    2、新建工程

    a、步骤一

    b、步骤二

    3、创建密钥

       a、桌面右键

    b、cd ~/.ssh/

    如果提示 “ No such file or directory”,你可以手动的创建一个 .ssh文件夹即可

            mkdir ~/.ssh

    c、配置全局的name和email,参照你创建的工程Git global setup

           git config --global user.name "椰子"
           git config --global user.email "995852922@qq.com"
     

     d、生成key

    ssh-keygen -t rsa -C "995852922@qq.com"

     e、最后生成两个文件:id_rsa和id_rsa.pub

       f、把id_rsa.pub里的内容粘贴到gitlab密钥中

     g、密钥创建成功

    4、上传项目

    a、右键要上传的项目,选择Git Bash Here

    b、输入下面的命令

    git config --global user.name "椰子"
    git config --global user.email "995852922@qq.com"
    git init
    git remote add origin ssh://git@42.123.127.93:10022/tyshawn/sdap1.git
    git add .
    git commit -m "程序源代码"
    git push -u origin master

    参考创建的工程页面:

    注意:如果使用http的方式上传,就不需要先申请ssh,可以用以下命令直接上传

    git config --global user.name "椰子"
    git config --global user.email "995852922@qq.com"
    git init
    git remote add origin http://xxxxxxxxxxxxxxxxxxxx.git
    git add .
    git commit -m "程序源代码"
    git push -u origin master

     c、项目上传成功

    5、gitlab更新代码

    gitlab上更新代码

    1.打开命令行的窗口,定位到项目所在的路径。

    2.输入:gitstatus,敲回车查看代码是否有更新,有更新的话会出现文件改变的文件名。(红色的)

    3.输入:gitcommit -a -m "tag",敲回车,然后你就会看到有几个文件修改了。(如果写了-m,那么“”中一定要写内容,不然会报错)

    4.最后提交到库里gitpush -u origin master

    创建项目是注意不要勾选:

    报错:

    解决:git push error: failed to push some refs to

    出现错误的原因是github中的README.md文件不在本地代码目录中。

    也就是说我们需要先将远程代码库中的任何文件先pull到本地代码库中,才能push新的代码到github代码库中。

    使用如下命令:git pull --rebase origin master

    然后再进行上传: git push -u origin master

  • 相关阅读:
    HashMap和HashSet的区别
    安卓坐标
    android MotionEvent中getX()和getRawX()的区别
    android 布局之滑动探究 scrollTo 和 scrollBy 方法使用说明
    register_chrdev_region/alloc_chrdev_region和cdev注册字符设备驱动
    将JZ2440的调试串口换成com2
    pcl点云文件格式
    C++中的迭代器
    C++中的vector
    “标准差”
  • 原文地址:https://www.cnblogs.com/js1314/p/12935617.html
Copyright © 2011-2022 走看看