我的技术博客测试小组-一步步提升测试技能

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

2018-09-26  本文已影响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)
$

最后终于提交成功。

上一篇下一篇

猜你喜欢

热点阅读