Re: [git-users] Why can't I push to a newly created repository?
I did init --bare, so that won't be a problem. These two commands may be helpful for figuring out the issue? On git repository server machine: $ git log master fatal: ambiguous argument 'master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' On git client machine: abigail@abilina:~/np/my-project$ git remote -v origin git@10.0.0.250:my-project.git (fetch) origin git@10.0.0.250:my-project.git (push) Does this indicate any issue? On Monday, October 30, 2017 at 1:20:26 AM UTC-7, Tim Rice wrote: > > Hi, > > I can't reproduce the problem precisely, but I'm guessing you did not set > up "origin" to be a *bare* repo. > > You can't push to regular repos. Distributing changes between regular > repos > requires a strict fork-and-pull workflow, although cloning is also > permitted. > > To set up a repo that you want to push to (analogous to a repo on GitHub) > you need something like the following procedure: > > $ mkdir ~/my-project.git/ # Alongside the regular repo ~/my-project/ > $ cd ~/my-project.git/ > $ git init --bare > $ cd ~/my-project/ > $ git remote add origin ~/my-project.git/ > $ git push origin master > > If the bare repo is on some other machine that you can ssh to instead of > locally, the changes to make are reasonably obvious: > > my-git-server $ mkdir ~/my-project.git/ > my-git-server $ cd ~/my-project.git/ > my-git-server $ git init --bare > > my-local-box $ cd ~/my-project/ > my-local-box $ git remote add origin my-git-server:my-project.git > my-local-box $ git push origin master > > Creating and manipulating bare repos is basically how GitHub works under > the hood. Everything else is just convenient bling-bling :) > > > Kind regards, > > > Tim > > > > On Mon, Oct 30, 2017 at 12:07:23AM -0700, Martin wrote: > > Hi, All: > > > > > > I created a repository on a home server. I can ssh to the server without > > any issue. I can also 'git clone' the empty repository from another home > > computer and everything works fine. > > > > I then tried a simple "git add, git commit". No issue! However, when I > do > > 'git push origin master', it got stuck there forever without issuing any > > warning or error message, as below: > > > > abigail@abilina:~/my-project$ git push origin master > > g...@10.0.0.250 's password: > > > > > Counting objects: 3, done. > > Writing objects: 100% (3/3), 208 bytes | 0 bytes/s, done. > > Total 3 (delta 0), reused 0 (delta 0) > > > > The push wasn't successful and got stuck like this. What could be the > > reason? > > > > Thanks. > > > > -- > > You received this message because you are subscribed to the Google > Groups "Git for human beings" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to git-users+...@googlegroups.com . > > For more options, visit https://groups.google.com/d/optout. > > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Why can't I push to a newly created repository?
On 10/31/2017 02:56 AM, Timothy Rice wrote: >> It is possible to push to a NON checked out branch of a non-bare repo (that >> was apparently what they did in the old days before I knew Git). >> >> I use that method at work, so that I have a network share that is the >> non-bare 'remote', and I have a local drive repo that I'm working on. The >> network share looks like it has a checked out 'master' on it, but if you >> ('they') realise it has the hidden .git folder, then they could see that >> (using Git) it also has my working branch 'philip' on it! > > That is interesting to know. The first time I tried pushing to a non-bare > repo, the slap on the wrist conditioned me to never do it again, so I never > looked any deeper :) Philip is correct. But still something is missed. Actually, you *can* push to a checkouted branch, provided that you have set the `receive.denyCurrentBranch` variable in the configuration file of the remote git repo. You should see remote output if you mistakenly try to push to a checkouted branch (in this case "master") of the remote git repo: remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the current branch in a non-bare repository remote: error: is denied, because it will make the index and work tree inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match remote: error: the work tree to HEAD. remote: error: remote: error: You can set 'receive.denyCurrentBranch' configuration variable to remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, set remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'. So, have fun with git ;-) Yubin -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Why can't I push to a newly created repository?
> It is possible to push to a NON checked out branch of a non-bare repo (that > was apparently what they did in the old days before I knew Git). > > I use that method at work, so that I have a network share that is the > non-bare 'remote', and I have a local drive repo that I'm working on. The > network share looks like it has a checked out 'master' on it, but if you > ('they') realise it has the hidden .git folder, then they could see that > (using Git) it also has my working branch 'philip' on it! That is interesting to know. The first time I tried pushing to a non-bare repo, the slap on the wrist conditioned me to never do it again, so I never looked any deeper :) ~ Tim -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Why can't I push to a newly created repository?
On Mon, Oct 30, 2017 at 12:07:23AM -0700, Martin wrote: > I created a repository on a home server. I can ssh to the server without > any issue. I can also 'git clone' the empty repository from another home > computer and everything works fine. > > I then tried a simple "git add, git commit". No issue! However, when I do > 'git push origin master', it got stuck there forever without issuing any > warning or error message, as below: > > abigail@abilina:~/my-project$ git push origin master > git@10.0.0.250's password: > > > Counting objects: 3, done. > Writing objects: 100% (3/3), 208 bytes | 0 bytes/s, done. > Total 3 (delta 0), reused 0 (delta 0) > > The push wasn't successful and got stuck like this. What could be the > reason? You mean your Git client literally hangs after those messages and does nothing (until you, say, Ctrl-C it)? -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Why can't I push to a newly created repository?
- Original Message - From: "Timothy Rice" I can't reproduce the problem precisely, but I'm guessing you did not set up "origin" to be a *bare* repo. You can't push to regular repos. Distributing changes between regular repos requires a strict fork-and-pull workflow, although cloning is also permitted. Just to correct one misunderstanding. What you cannot do is push the current HAED branch of the remote (non-bare) repo. It is possible to push to a NON checked out branch of a non-bare repo (that was apparently what they did in the old days before I knew Git). I use that method at work, so that I have a network share that is the non-bare 'remote', and I have a local drive repo that I'm working on. The network share looks like it has a checked out 'master' on it, but if you ('they') realise it has the hidden .git folder, then they could see that (using Git) it also has my working branch 'philip' on it! But I can't have the same branch checked out on both and push one to the other. -- Philip -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [git-users] Why can't I push to a newly created repository?
Hi, I can't reproduce the problem precisely, but I'm guessing you did not set up "origin" to be a *bare* repo. You can't push to regular repos. Distributing changes between regular repos requires a strict fork-and-pull workflow, although cloning is also permitted. To set up a repo that you want to push to (analogous to a repo on GitHub) you need something like the following procedure: $ mkdir ~/my-project.git/ # Alongside the regular repo ~/my-project/ $ cd ~/my-project.git/ $ git init --bare $ cd ~/my-project/ $ git remote add origin ~/my-project.git/ $ git push origin master If the bare repo is on some other machine that you can ssh to instead of locally, the changes to make are reasonably obvious: my-git-server $ mkdir ~/my-project.git/ my-git-server $ cd ~/my-project.git/ my-git-server $ git init --bare my-local-box $ cd ~/my-project/ my-local-box $ git remote add origin my-git-server:my-project.git my-local-box $ git push origin master Creating and manipulating bare repos is basically how GitHub works under the hood. Everything else is just convenient bling-bling :) Kind regards, Tim On Mon, Oct 30, 2017 at 12:07:23AM -0700, Martin wrote: > Hi, All: > > > I created a repository on a home server. I can ssh to the server without > any issue. I can also 'git clone' the empty repository from another home > computer and everything works fine. > > I then tried a simple "git add, git commit". No issue! However, when I do > 'git push origin master', it got stuck there forever without issuing any > warning or error message, as below: > > abigail@abilina:~/my-project$ git push origin master > git@10.0.0.250's password: > > > Counting objects: 3, done. > Writing objects: 100% (3/3), 208 bytes | 0 bytes/s, done. > Total 3 (delta 0), reused 0 (delta 0) > > The push wasn't successful and got stuck like this. What could be the > reason? > > Thanks. > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to git-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[git-users] Why can't I push to a newly created repository?
Hi, All: I created a repository on a home server. I can ssh to the server without any issue. I can also 'git clone' the empty repository from another home computer and everything works fine. I then tried a simple "git add, git commit". No issue! However, when I do 'git push origin master', it got stuck there forever without issuing any warning or error message, as below: abigail@abilina:~/my-project$ git push origin master git@10.0.0.250's password: Counting objects: 3, done. Writing objects: 100% (3/3), 208 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) The push wasn't successful and got stuck like this. What could be the reason? Thanks. -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to git-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.