2015-06-05 141 views
1

我對git,gitLab很新。我正在嘗試下載一個項目(完成),編輯它(完成),並將新版本推送到唯一的主分支。我確實爲此保留了權利。Git首先拉和推到主問題

步驟I遵循:

1-I已經手動下載(從網頁GUI)從gitLab從只有主分支的項目。

2-我在本地對項目進行了修改。

3-我創建了一個新文件夾(gitCommit)。

4-我將編輯過的項目複製到gitCommit文件夾中,該文件夾現在保存着包含該項目的「TheDB」文件夾。

5-我打開終端:cd Desktop ..../gitCommit。現在我在「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

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的承諾-m '的形式生成字段和驗證'

[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我運行:遠程Git添加起源https://gitlab.com/TheDBdevs/TheDB.git

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

我不知道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

+0

感謝這麼多的澄清,並指出後一個新的情況下,我會現在就試試這個 –