2018-09-26把本地的项目上传到git仓库

作者: 卜了了 | 来源:发表于2018-09-26 12:14 被阅读2次

参考的文章:# 如何用命令将本地项目上传到git

操作的步骤:

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform
$ git init
Initialized empty Git repository in D:/lele/test_dev/test_platform/.git/

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git add .
warning: LF will be replaced by CRLF in .idea/workspace.xml.
The file will have its original line endings in your working directory.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git commit -m "新的项目"
[master (root-commit) 39ccd74] 新的项目
 28 files changed, 593 insertions(+)
 create mode 100644 .idea/misc.xml
 create mode 100644 .idea/modules.xml
 create mode 100644 .idea/test_platform.iml
 create mode 100644 .idea/workspace.xml
 create mode 100644 db.sqlite3
 create mode 100644 manage.py
 create mode 100644 test_platform/__init__.py
 create mode 100644 test_platform/__pycache__/__init__.cpython-37.pyc
 create mode 100644 test_platform/__pycache__/settings.cpython-37.pyc
 create mode 100644 test_platform/__pycache__/urls.cpython-37.pyc
 create mode 100644 test_platform/__pycache__/wsgi.cpython-37.pyc
 create mode 100644 test_platform/settings.py
 create mode 100644 test_platform/urls.py
 create mode 100644 test_platform/wsgi.py
 create mode 100644 user_app/__init__.py
 create mode 100644 user_app/__pycache__/__init__.cpython-37.pyc
 create mode 100644 user_app/__pycache__/admin.cpython-37.pyc
 create mode 100644 user_app/__pycache__/apps.cpython-37.pyc
 create mode 100644 user_app/__pycache__/models.cpython-37.pyc
 create mode 100644 user_app/__pycache__/views.cpython-37.pyc
 create mode 100644 user_app/admin.py
 create mode 100644 user_app/apps.py
 create mode 100644 user_app/migrations/__init__.py
 create mode 100644 user_app/migrations/__pycache__/__init__.cpython-37.pyc
 create mode 100644 user_app/models.py
 create mode 100644 user_app/templates/index.html
 create mode 100644 user_app/tests.py
 create mode 100644 user_app/views.py

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote add origin git@github.com:happy_today/test_platform.git

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git push -u origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$

git查看远程仓库地址命令
在项目地址下面输入:
git remote -v
即可查看到地址啦。

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev
$ ls
mysite/  test_dev/  test_platform/

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev
$ cd test_platform/

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote-v
git: 'remote-v' is not a git command. See 'git --help'.

The most similar command is
        remote-fd

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote -v
origin  git@github.com:happy_today/test_platform.git (fetch)
origin  git@github.com:happy_today/test_platform.git (push)

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote add origin git@github.com:happy_today/test_platform.git
fatal: remote origin already exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git pull --rebase origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git push -u origin master
Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts.
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote add origin git@github.com:happy_today/test_platform.git
fatal: remote origin already exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote add origin https://git@github.com:happy_today/test_platform.git
fatal: remote origin already exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git pull --rebase origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$

刚又在github里面新建了项目 test_platform,然后获得git地址,这个地址跟我自己在项目下获得的地址有出入,名字差个“10”,所以没成功。
先是删除那个origin,然后再把步骤重新走一遍,然后就提交代码成功了。

$ git remote rm origin

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git init
Reinitialized existing Git repository in D:/lele/test_dev/test_platform/.git/

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git add .

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git commit -m "44"
On branch master
nothing to commit, working tree clean

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git remote add origin https://github.com/happytoday10/test_platform.git

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git pull --rebase origin master
warning: no common commits
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/happytoday10/test_platform
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: 新的项目
Applying: 22

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git status
On branch master
nothing to commit, working tree clean

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$ git log
commit fa39b62b682a18349f720a4fc6d0b22fd13de6bf (HEAD -> master)
Author: happytoday10 <41659746+happytoday10@users.noreply.github.com>
Date:   Wed Sep 26 12:02:16 2018 +0800

    22

commit d89818a1d961aa95371ddd38bcf26d37e772cfa7
Author: happytoday10 <41659746+happytoday10@users.noreply.github.com>
Date:   Wed Sep 26 09:02:44 2018 +0800

    新的项目

commit f8ca27feeb51b4333990a8bc47659284b04cb369 (origin/master)
Author: happytoday10 <41659746+happytoday10@users.noreply.github.com>
Date:   Wed Sep 26 12:05:06 2018 +0800

    Initial commit

Administrator@DESKTOP-8HBOVNF MINGW64 /d/lele/test_dev/test_platform (master)
$

最后终于提交成功。

相关文章

  • 上传本地代码到github

    新创建的本地代码上传到github上 一:建立git仓库 cd到你的本地项目根目录下,执行git命令 git in...

  • mave ninstall 报错No compiler is p

    最近折腾maven项目 git push 本地web项目通过git上传到代码仓库 wget wget https:...

  • Git与Hexo命令

    用git如何把项目上传到github安装就不必多说了,在本地仓库中打开git bash命令窗口,执行如下命令 仓库...

  • git 使用命令(1)

    Git 全局设置: 本地项目上传到git仓库 下载git工具 https://git-scm.com/downlo...

  • 使用git 托管项目到码云

    1.找到项目所在位置初始化本地仓库 2.将本地项目上传到码云,git语句 2.1:git init 初始化本地仓库...

  • 2018-09-26把本地的项目上传到git仓库

    参考的文章:# 如何用命令将本地项目上传到git 操作的步骤: git查看远程仓库地址命令在项目地址下面输入:gi...

  • 上传本地代码到github

    快速参考 怎么将新创建的本地代码上传到github上 第一步:建立git仓库cd到你的本地项目根目录下,执行git...

  • flask day03

    关于 git从本地上传到github git init 将所有文件添加到仓库git add 把所有文件提交到仓库,...

  • 码云和git的使用

    一、本地项目上传到远程仓库 建立本地git仓库 将本地项目工作区的所有文件添加到暂存区 将暂存区的文件提交到本地仓...

  • 在Linux上部署Laravel遇到的问题

    一、把本地项目上传到git远程仓库 1.初始化项目 2.文件添加到版本库 3.文件提交到仓库 4.关联远程仓库 5...

网友评论

    本文标题:2018-09-26把本地的项目上传到git仓库

    本文链接:https://www.haomeiwen.com/subject/qvfdoftx.html