Git首先拉动并推动掌握问题

时间:2015-06-05 07:09:18

标签: git gitlab

我是git,gitLab的新手。我正在尝试下载项目(完成),编辑它(完成),并将新版本推送到唯一的主分支。我对此有权利。

我遵循的步骤:

1 - 我从gitLab手动(从网页GUI)下载了一个来自唯一主分支的项目。

2-我在本地制作了对项目的更改。

3-我创建了一个新文件夹(gitCommit)。

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

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

6-我运行git init

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

7-I run:git pull 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 run:git add。

9-I run:git commit -m'表单生成器字段和验证'

    [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-我运行:git remote add 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.

我做错了什么?

1 个答案:

答案 0 :(得分:1)

我不知道gitlab或gitlab web界面。但是在您的计算机中获得回购以及在推送到远程回购之后的常用步骤是:

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

不正确,不需要最后一个“主人”。

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

添加遥控器的这一步骤仅适用于您没有克隆回购并且在git init

之后创建新回购的情况