Git 第一次pull和push to master issue

Git first pull and push to master issue

我是 git、gitLab 的新手。我正在尝试下载一个项目(完成),编辑它(完成),并将新版本推送给唯一的主人 branch.I 对此拥有权利。

我遵循的步骤:

1-我已经从 gitLab 唯一的 master 分支中手动(从 Web GUI)下载了一个项目。

2- 我在本地对项目进行了所有更改。

3- 我创建了一个新文件夹(git提交)。

4- 我将我编辑的项目复制到 gitCommit 文件夹中,该文件夹现在包含包含该项目的 "TheDB" 文件夹。

5- 我打开终端:cd Desktop..../git提交。现在我在里面 "gitCommit".

6-我运行git初始化

Initialized empty Git repository in /Users/alex_fimm_dev/Desktop/Projects/FIMM/gitCommit/.git/

7-I 运行: git 拉 https://gitlab.com/TheDBdevs/TheDB.git master

    remote: Counting objects: 2851, done.
remote: Compressing objects: 100% (2088/2088), done.
remote: Total 2851 (delta 1155), reused 2223 (delta 694)
Receiving objects: 100% (2851/2851), 14.21 MiB | 13.87 MiB/s, done.
Resolving deltas: 100% (1155/1155), done.
From https://gitlab.com/TheDBdevs/TheDB
 * branch            master     -> FETCH_HEAD

8-I 运行: git 添加 .

9-I 运行: git commit -m 'form generator fields and validations'

    [master 1c7b506] form generator fields and validations
 Committer: Alexander Thorarinsson <alex_fimm_dev@lm5-fim4-0G3QD.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

    git config --global user.name "Your Name"
    git config --global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1198 files changed, 571617 insertions(+)
 create mode 100644 TheDB/.gitignore
 create mode 100644 TheDB/data_for_import/FO4 and 3 merged.xlsx

 ...

 create mode 100644 TheDB/webapp/views/qrcodesetup.tt
 create mode 100644 TheDB/webapp/views/questionnaire.tt
 create mode 100644 TheDB/webapp/views/register.tt

10- I 运行 : git 远程添加 origin https://gitlab.com/TheDBdevs/TheDB.git master

    usage: git remote add [<options>] <name> <url>

    -f, --fetch           fetch the remote branches
    --tags                import all tags and associated objects when fetching
                          or do not fetch any tag at all (--no-tags)
    -t, --track <branch>  branch(es) to track
    -m, --master <branch>
                          master branch
    --mirror[=<push|fetch>]
                          set up remote as a mirror to push to or fetch from

lm5-fim4-0G3QD:gitCommit alex_fimm_dev$ git push origin master
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

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

我做错了什么?

我不知道 gitlab 或 gitlab 网络界面。但是在您的计算机中获取回购并在推送提交到远程回购之后的常见步骤是:

git clone remote_repo_url
# make changes
git add -u
git commit -m "message"
git push origin master

克隆存储库时不需要添加远程。克隆自动配置默认源远程

顺便说一句,您的命令中至少有一个错误

git remote add origin https://gitlab.com/TheDBdevs/TheDB.git master

不正确,不需要最后的"master"。

git remote add origin https://gitlab.com/TheDBdevs/TheDB.git

添加远程的这一步仅适用于您不克隆存储库并在 git init

之后创建新存储库的情况