zoukankan      html  css  js  c++  java
  • 把本地git仓库的项目上传到远程仓库

    之前在学校实验室服务器上建了一个git远程仓库,存放我写的express项目代码。后来由于出去实习,就无法访问那个远程仓库了,因为它在校园网内。

    还好我的笔记本中有这个项目完整的本地仓库,于是我就试着在阿里云中新建一个仓库,这样就能把我的本地仓库的代码都上传上去。

    首先,我再home目录创建了仓库文件夹,然后在这个文件夹下创建一个子文件夹作为我express项目的仓库目录

    mkdir /home/repository/meadowlark.git

    在meadowlark.git目录下,运行

    git --bare init

    简单两步,服务器端的任务就完成了。


    然后,我再本地仓库运行

     git remote -v

    可以看到之前设置的远程仓库地址

    origin root@10.21.20.***:/home/nodejs/meadowlark.git (fetch)
    origin root@10.21.20.***:/home/nodejs/meadowlark.git (push)

    现在已经没用了需要删掉。

    git remote rm origin

     然后设置新的远程仓库地址

    git remote add origin username@192.168.1.1:/home/repository/meadowlark.git

    到这里基本已经结束了,我试着运行git push, bash提示我

    fatal: The current branch master has no upstream branch.
    To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

    按照提示输入上面的命令之后,本地仓库的代码都已经上传到远程仓库了。

    以后使用

    git push

    也没再出现问题。

    朋友想拉取我的项目代码,我让他直接输入

    git clone root@192.168.1.1:/home/repository/meadowlark.git

    就能把代码拉取下来,这也说明我们的远程仓库是没有问题的。

  • 相关阅读:
    氚云CRM产品的详细介绍
    关于氚云PasS的介绍
    氚云tERP介绍
    转: Photon 3.4 Changed Logs ..
    DelphiXE5 Flappy Bird 复制版
    mono developer 无法启动 可以试试如下插件包.
    Happening in delphi world
    string manipulation in game development-C # in Unity
    Comparing Xamarin and Delphi XE5 to Xcode for Cross Platform Mobile App Development
    混用Application.LoadLevel 和 PhotonNetwork.LoadLevel
  • 原文地址:https://www.cnblogs.com/miaodi/p/7147818.html
Copyright © 2011-2022 走看看