Git first pull and push to master issue

1.3k views Asked by At

I am very new to git, gitLab. I am trying to download a projects(done), edit it(done), and push the new version to the only master branch.I do heve rights for this.

Steps I have followed:

1-I have downloaded manually(from web GUI) from gitLab a project from the only master branch.

2- I made locally al the changes to the project.

3- I created a new folder(gitCommit).

4- I copy my edited project inside gitCommit folder which now holds "TheDB" folder containing the project.

5- I open the terminal : cd Desktop..../gitCommit. Now I am inside "gitCommit".

6- I run 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 'form generator fields and validations'

    [master 1c7b506] form generator fields and validations
 Committer: Alexander Thorarinsson <[email protected]>
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 [email protected]

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 run : 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.

What am I doing wrong?

1

There are 1 answers

0
Francisco Puga On BEST ANSWER

I don't know about gitlab or the gitlab web interface. But the common steps to get a repo in your computer and after that push commits to the remote repo are:

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

When you clone a repo you don't need to add a remote. Clone autoconfigures a default origin remote

BTW you have at least one error in your commands

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

is not correct, the last "master" is not needed.

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

This step of adding a remote is only for the case that you don't clone a repo and are creating a new one after a git init