После git push origin файлы в репозитории не обновились
Я только начал использовать git с github. Я следовал их инструкциям и столкнулся с ошибками на последнем шаге. Я проверяю существующий каталог, который в настоящее время не контролируется источником (проект около недели). Кроме этого, мой прецедент должен быть довольно запущенным.
вот что происходит:
У меня была та же проблема, а затем ударил себя по голове, потому что я на самом деле не добавил свои файлы проекта.
у меня была та же проблема. Я удалил .затем папка git выполнила следующие команды
- $ git init
- $ git add .
- $ git remote add origin git@gitorious.org:project/project.git
- $ git commit -m "Initial version"
- $ git push origin master
у меня такая же проблема . это решило мою проблему . Если вы init свой git . вы должны сделать на терминале
2) git commit -m "first commit"
для отправки в bitbucket
у меня была такая же проблема при создании моего первого репозитория Git. У меня была опечатка в удаленном создании git origin - оказывается, я не использовал имя своего репозитория.
сначала я удалил старый пульт с помощью
затем я воссоздал происхождение, убедившись, что имя моего происхождения было напечатано точно так же, как было написано мое происхождение.
больше ошибок нет! :)
у меня была такая же ошибка, как Bombe сказал, что у меня нет локальной ветви с именем master в моей конфигурации, хотя git branch did список ветви с именем master.
своего рода hacky, но делает работу
убедитесь, что вы находитесь на ветке, по крайней мере в ветку master
ubuntu-user:~/git / куркума-releng$ git филиал
тогда все ваши изменения будут вписываться в главную ветку (или ветку u выберите)
чтобы фактически решить проблему, я использовал следующую команду для вывода всех моих файлов на фиксацию.
проблема заключалась в том, что команда-u в git add фактически не добавляла новые файлы, а команда git add-a не поддерживалась при моей установке git. Таким образом, как упоминалось в этой теме, фиксация, которую я пытался выполнить, была пустой.
я исправил свою проблему.
не уверен, в чем проблема, но использование интерфейса gitx для фиксации моих поэтапных файлов.
работали.
у меня такая же проблема.
создана новая папка, добавленная в файлы шаблонов bort.
затем я получаю ту же ошибку.
У меня была такая же проблема. Я ошибочно создал каталог в машине в нижнем регистре. После изменения случая проблема решена(но впустую потратила мои 1,5 часа :( ) Проверьте, что ваше имя каталога и имя удаленного РЕПО одинаковы.
У меня была эта ошибка, а также на совершенно новом репозитории github. Оказывается, у пользователя, которого я отталкивал, не было доступа push. По какой-то причине это приводит к ошибке "ошибка: репозиторий не найден" вместо какой-то ошибки доступа.
в любом случае, я надеюсь, что это поможет бедной душе, которая сталкивается с тем же вопрос.
имел ту же проблему минуту назад, а затем исправил ее
создайте репозиторий в github под названием wordpress.
это должно работать для решения проблемы refspec
Я mistankly поставил пробел после - так вместо-м у меня было-м Просто есть на что посмотреть.
Я думаю, что в старой версии git вы должны сначала зафиксировать хотя бы один файл, а затем снова "нажать origin master".
большой.. его проблема с пустым каталогом только ничего больше. Я решил свою проблему, создав один двоичный файл в каждом каталоге, а затем добавил их.
инициал add & commit работал как шарм. Я думаю, это просто вопрос понимания методологии Git для управления проектом в репозитории.
после этого мне удалось сразу же отодвинуть мои данные без каких-либо проблем.
когда вы создаете репозиторий на Github, он добавляет README.MD файл в репо и так как этот файл может не быть в вашем локальном каталоге, или, возможно, он может иметь другое содержимое git push не удастся. Чтобы решить проблему, я сделал:
на этот раз это сработало, так как у меня был README.файл md.
перед первым фиксацией попробуйте добавить файл, например readme.формат txt. Это "заставит" удаленное РЕПО создать мастер ветви в случае, если это не существует. Для меня это сработало.
Это очень старый вопрос, но для всех новых людей, которые окажутся здесь, как я. Это решение только для
ошибка для нового созданного РЕПО
вы должны добавить
только после добавления электронной почты и имени добавьте файлы в git и commit
Он будет работать как шарм
У меня тоже есть эта ошибка, я ставлю фиксацию для не push пустой проект, как многие люди, но не работает
проблема была в ssl, y поставил следующий
и после этого все работает нормально :)
у меня была такая же проблема/ошибка.Я делал git push -u origin master вместо этого я просто сделал git push origin master и это сработало.
У меня была такая же проблема, некоторые пользователи уже ответили на этот. Перед push вы должны иметь свой первый commit. Теперь для новых пользователей, я создал ряд простых шагов. Перед этим вам нужно установить git и запустить в командной строке:
- пользователь конфигурации git.email "your email"
- пользователь конфигурации git.имя "name"
шаги по созданию удаленного репозитория (я использую dropbox в качестве удаленного репозитория):
I have set up a git repository on my local machine and a bare repository on a linode box. When doing a git push there are no errors but I do not see the file on the remote server. The sequence of commands I followed was below:
On local machine:
But when I check on the linode the file is absent:
Am I missing something obvious here? The communication is via ssh and the keys are set up as expected, I can login without a password. However the file does not get copied to the remote server.
21 Answers 21
git push doesn't push all of your local branches: how would it know which remote branches to push them to? It only pushes local branches which have been configured to push to a particular remote branch.
On my version of Git (1.6.5.3), when I run git remote show origin it actually prints out which branches are configured for push:
Q. But I could push to master without worrying about all this!
When you git clone , by default it sets up your local master branch to push to the remote's master branch (locally referred to as origin/master ), so if you only commit on master , then a simple git push will always push your changes back.
However, from the output snippet you posted, you're on a branch called develop , which I'm guessing hasn't been set up to push to anything. So git push without arguments won't push commits on that branch.
When it says "Everything up-to-date", it means "all the branches you've told me how to push are up to date".
Q. So how can I push my commits?
If what you want to do is put your changes from develop into origin/master , then you should probably merge them into your local master then push that:
If what you want is to create a develop branch on the remote, separate from master , then supply arguments to git push :
That will: create a new branch on the remote called develop ; and bring that branch up to date with your local develop branch; and set develop to push to origin/develop so that in future, git push without arguments will push develop automatically.
If you want to push your local develop to a remote branch called something other than develop , then you can say:
However, that form won't set up develop to always push to origin/something-else in future; it's a one-shot operation.
I am making changes to some file in my local git repository and then want to send the changes to the remote git repository from which the local was cloned via ssh.
After run "git commit -a" on my local side, to send the changes to the remote, I run
However I checked the remote files and they are not changed! Any idea?
Thanks and regards!
16 Answers 16
Have you tried the following?
Use git remote to find out the name(s) of your remote(s). The default remote is origin , which is automatically created when cloning a repository.
@CharlieParker maybe you have changed the push.default configuration from current to simple ? simple is the default starting with Git 2.0. Before Git 2.0 matching was the default.
@knittl I got this error. 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.
@vishal I don't understand your latest comment and it doesn't answer my question. What does git remote or git remote -v show? Does it contain a line for origin ? If not, which remotes do you have configured (i.e. are shown by the command)?
I found that the issue was that I had not added the files to the update as well as a message. I fixed this by using the following commands:
Hope this helps someone ;)
You probably pushed into a non-bare repository, i.e. a repository that has a working copy attached to it. You shouldn’t have ignored the warning git push gives you if it notices that this is the case.
Anyway, log in to the remote machine, change to the repository and do
There you go. Next time only push into bare repositories. :)
I managed to solve this problem as what you said but I am still confused and not understand what I was doing. Does non-bare means that I can edit files in the repository directly and bare means that the files in the repository does not allow to be edited? What kind of warning git push gives, which I didn't notice? Thanks!
A “bare” repository is a repository that does not have a working copy, i.e. you can not edit any files in it. The repository path directly contains everything that is normally in the .git folder of a non-bare repository, and in fact a bare repository is only this folder. When pushing to a non-bare repository you do not change the files that are currently checked out. You need to update the working code separately, e.g. with git checkout or git reset .
Just don’t push into a repository that has a working tree attached. The warning is there for a reason! If you do not understand the ramifications of pushing into a non-bare repository, then don’t do it. Don’t look for workarounds but use a sensible structure instead: push to a bare repository somewhere else and then pull from your destination.
I had the same issue and it was because I had checked out to a point in the history (in this case a tag), rather than the end (head) of any branch or master. I would make the change and commit which would succeed and I would see the changes in my local history. When I ran git push, git stated everything was fine, but the change had not actually been submitted to the server (which can be seen by checking the logs, or by re-cloning the repo and checking it's logs). The best symptom of this mistake is seeing the message "Head detatched from ____"
The Solution
What one actually needs to do (if you have done what I've done) is create a new line of development by creating a branch and switching to that branch before making the changes.
Then after committing the changes, if you want the changes to be pushed to the server you need to push the branch itself to the server.
Now if you clone the repository, you should see your changes in the logs. However, next time you clone the repository, to be able to go to that point you just changed, you will need to checkout that branch, as you will default to being on the main line which is "further" down the development line from where you branched off.
Я пытаюсь обновить репозиторий Git на GitHub. Я сделал кучу изменений, добавил их, совершил, а затем попытался сделать git push . Ответ говорит мне, что все обновлено, но очевидно, что это не так.
отвечает репозиторием, который я ожидал.
почему Git говорит мне, что репозиторий обновлен, когда есть локальные коммиты, которые не видны в репозитории?
git push не толкает все ваши локальные ветви: как он узнает, какие удаленные ветви их толкать? Он только толкает локальные ветви, которые были настроены для толчка к определенной удаленной ветви.
на моей версии Git (1.6.5.3), когда я запускаю git remote show origin он фактически печатает, какие ветви настроены для push:
Q. но я мог бы нажать на master , не беспокоясь обо всем этом!
когда вы git clone , по умолчанию он устанавливает локальный master ветка, чтобы нажать на пульт master филиал (локально называемый origin/master ), так что если вы совершаете только на master и git push всегда будет толкать свои изменения обратно.
однако, из выходного фрагмента, который вы опубликовали, вы находитесь в ветке под названием develop , который, как я предполагаю,не был настроен ни на что. Так что git push без аргументов не будет нажимать коммиты на этой ветке.
когда он говорит: "Все up-to-date", это означает"все ветви, которые вы сказали мне, как нажать, актуальны".
Q. Итак, как я могу нажать мои коммиты?
если то, что вы хотите сделать, это внести изменения из develop на origin/master , тогда вы можете объединить их в локальную master тогда Нажмите это:
если вы хотите создать develop ветка на пульте, отдельно от master , потом аргументы git push :
это будет: создать новую ветку на пульте под названием develop ; и приведите эту ветку в соответствие с вашим местным develop филиала; и set develop для передачи origin/develop так что в будущем git push без аргументов будет push develop автоматически.
если вы хотите нажать ваш местный develop в удаленную ветку под названием Что-то кроме develop , то вы можете скажи:
однако, что форма не настройка develop всегда нажимать на origin/something-else в будущем; это одноразовая операция.
это произошло со мной, когда мое приложение SourceTree разбилось во время постановки. И в командной строке это выглядело как предыдущее git add были повреждены. Если это так, попробуйте:
по последней команде вам может потребоваться установить ветку.
имейте в виду, что этого достаточно, если вы не сделали ветвления или любого из этого рода. В этом случае, убедитесь, что вы нажимаете на правильную ветку, как git push origin develop .
3 Answers 3
If you want to both push to the repo and have the files update, you can create a server-side git hook to checkout the files after they've been pushed. In the server side git /hooks/ directory create a file named post-receive and add the following code:
Then give the file proper permissions using chmod +x post-receive
Note: the above code assumes your git directory and deployed files are in different directories. Update the file depending on how you want things configured.
Git doesn't work that way on the server side. The files are highly compressed and grouped into chunks so you can't find a particular file.
To test your git server, create another clone in another directory and see if app.py is there.
Ah, that is something I had missed entirely. I cloned the repository on the server and I then saw the file there. So I suppose the workflow for now will be to develop locally, push to the linode and then login to the linode and clone the repo. Thanks for the help.
Does this mean that to have a client-server style architecture you need to have 2 clients (1 on client and 1 on server) + a cryptic repository (on server)?
From what I understood from DigitalGhost's answer the idea is that the repository to which I pushed does not contain the files as-is but it has the ability to serve out files as part of the cloning operation. So you always need a server (of course) but it will not serve plaintext files, clients (anywhere, remote or local) will need to clone the repo contents.
The key point here is that you have a 'bare' repository on your remote (kangaroo). A bare repository does not have a local checkout - a local working tree. This is the standard git way of working with a remote to which you are pushing files. You can push to a non-bare repository on a remote, but you will have to override the standard git settings. Probably better to use two-repository solution on the remote as suggested by Kyle Chadha below.
I am working on a project to present the contents of a branch/revision/tag of a repo on a virtual FS. It's based on fuse and libgit2. It's in the very early stages at the moment but it can show you the files/directories in a revision and their contents. If you ask to use a branch, if the branch is moved, it will refresh the virtual FS on the fly. Just in case: early stages so no LFS, no submodules, no. whatever fancy feature you are thinking of? None of that. Just trees and blobs in git jargon.
Not the answer you're looking for? Browse other questions tagged git push or ask your own question.
Related
Hot Network Questions
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
Site design / logo © 2022 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2022.5.12.42104
I'm trying to update a Git repository on GitHub. I made a bunch of changes, added them, committed then attempted to do a git push . The response tells me that everything is up to date, but clearly it's not.
responds with the repository I'd expect.
Why is Git telling me the repository is up to date when there are local commits that aren't visible on the repository?
Читайте также: