Невозможно отправить файлы в удаленное хранилище - PullRequest
0 голосов
/ 01 октября 2019

Я клонировал пустое repo для проекта, на который меня пригласили, но затем не могу отправить файлы на удаленный компьютер (первое нажатие).

git remote -v
origin  https://gitlab.com/project-path (fetch)
origin  https://gitlab.com/project-path (push)

Я могу подтвердить, что успешно добавил свой ssh открытый ключ:

ssh -T git@gitlab.com
Welcome to GilLab, @username!

Но не удается отправить файл:

git push README.md
fatal: invalid gitfile format: README.md
fatal: Could not read from remote repository.

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

Что мне здесь не хватает?

1 Ответ

1 голос
/ 01 октября 2019

Вы не можете отправить файл в удаленную ветку. git push работает с филиалами.

Вот простой рабочий процесс.

# modify the README.md file, or any other file

# add it and make a commit
git add REAME.md
git commit -m "update README"

# push the branch to remote, replace "<remote-repo>" with real repo name
git push <remote-repo> <branch>
# or
git push <remote-repo> <local-branch>:<remote-branch>
# eg
git push origin master

Кстати, ваш открытый ключ ssh не будет использоваться в git push в этой ситуации. Причина "удаленная" ветвь origin использует протокол https, но не протокол git.

...