Skip to content

When creating a repo no upstream is set up. #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bubu opened this issue Jan 20, 2017 · 8 comments
Closed

When creating a repo no upstream is set up. #99

Bubu opened this issue Jan 20, 2017 · 8 comments
Assignees
Milestone

Comments

@Bubu
Copy link

Bubu commented Jan 20, 2017

When I run git lab create group/repo the repository is successfully created online but locally I still have no remotes set up.

I started from a newly created repo without any remotes.

@guyzmo guyzmo self-assigned this Jan 21, 2017
@guyzmo
Copy link
Owner

guyzmo commented Jan 21, 2017

from the help:

[…]
    git-repo [--path=<path>] [-v...] <target> create [--add]
    git-repo [--path=<path>] [-v...] <target> create <user>/<repo> [--add]
[…]
Options for create:
    --add                    Add to local repository after creation
[…]

i.e.: if you do:

git lab create --add group/repo

it will be added to the current repository, if you're in one.

I decided to default to not change the local directory per default, because you're not necessarily creating a repository when you're in a directory you've already git inited. And removing a remote is not hard, but because names are autogenerated it's not always obvious (--add will create two remotes, gitlab and all).

But, if you forgot to add, it's really not a big deal, you just do one more command:

git lab add group/repo gitlab

cf the -h for add:

    git-repo [--path=<path>] [-v...] <target> add <user>/<repo> [<name>] [--tracking=<branch>] [-a]
[…]
Options for add:
    <name>                   Name to use for the remote (defaults to name of repo)
    -t,--tracking=<branch>   Makes this remote tracking for the current branch
    -a,--alone               Does not add the remote to the 'all' remote

I'm planning to split the huge --help screen into different --help for each subcommand, but at the time being, having them all in one place makes it easier to mold the CLI API.

Any thoughts?

@Bubu
Copy link
Author

Bubu commented Jan 21, 2017

I must have missed that in the help output.

But I just tried again with --add and also the add subcommand. The result is always the following error:
Fatal error: 'GitlabService' object has no attribute 'gl' I'll rename the issue accordingly.

Re: default action: Can you explain what the use case/workflow for not adding a newly created repo as a remote is?

Edit: Github seems to work.

@Bubu Bubu changed the title When creating a repo no upstream is set up. Fatal error when adding a gitlab remote. Jan 21, 2017
@guyzmo
Copy link
Owner

guyzmo commented Jan 21, 2017

oh, sorry, it's already being taken care of, cf #97 and #98. I'm working on releasing 1.8.1 ASAP! 😖

@guyzmo guyzmo changed the title Fatal error when adding a gitlab remote. When creating a repo no upstream is set up. Jan 21, 2017
@guyzmo
Copy link
Owner

guyzmo commented Jan 21, 2017

Re: default action: Can you explain what the use case/workflow for not adding a newly created repo as a remote is?

Because when you do git X create foo/bar you're might be doing it in advance for a future code you're about to push, and you don't want to mess up another repository you might be in. And then you'd end up having repositories of two projects mixed together in a single .git/config, not nice.

As I considered that if you actually aimed to add the default upstream in current repository but forgot to do so, running git lab add group/repo gitlab wouldn't be too much of a hassle, I thought it would be a sane default to not mutate current repository when doing create.

@Bubu
Copy link
Author

Bubu commented Jan 21, 2017

oh, sorry, it's already being taken care of, cf #97 and #98. I'm working on releasing 1.8.1 ASAP! 😖

I see, thanks!

I thought it would be a sane default to not mutate current repository when doing create.

I understand your reasoning now. Would you consider changing the default behaviour when inside a local repo without remotes?

@guyzmo
Copy link
Owner

guyzmo commented Jan 21, 2017

I thought it would be a sane default to not mutate current repository when doing create.

I understand your reasoning now. Would you consider changing the default behaviour when inside a local repo without remotes?

yup, the only tough thing would be to correctly explain it off in the documentation. Though, it might become easier to explain when I'll refactor the CLI part of git-repo (where you'll have git X create --help that will have an independant help page from git-repo --help)

@metasean
Copy link

metasean commented Apr 9, 2017

I'm running git-repo version 1.9.0. When I run add (e.g. git lab add group/project) the remote is successfully added. Unfortunately, there is still no upstream set.

@guyzmo guyzmo changed the title When creating a repo no upstream is set up. When creating a repo no upstream is set up. May 4, 2017
@guyzmo guyzmo added this to the 1.10 milestone May 5, 2017
@guyzmo
Copy link
Owner

guyzmo commented May 5, 2017

@metasean if you do git lab add group/project it won't add an upstream.

if you do git lab add group/project upstream it will add group/project as upstream.

and when I'll release v1.10, git lab add upstream will setup the upstream remote automagically.

@guyzmo guyzmo closed this as completed May 5, 2017
@guyzmo guyzmo removed the ready label May 5, 2017
guyzmo added a commit that referenced this issue May 8, 2017
First anniversary release 🎂

This release marks the first anniversary
and 10th release of git-repo 🎉

Now git-repo supports 6 git services:

  github, gitlab, bitbucket,
  gogs, gitea and gitbucket

It supports the following commands:

  clone, fork, create, delete,
  add, open, ls, request, gist

And it's becoming relatively stable
(keep sending bug reports 🙏)

♥ Contributors

Thanks to @kounoike for the gitbucket support 🙌

Now there are three contributors promoted to collaborators:

* @kounoike, @pyhedgehog and @Crazybus

🚧 Features

* When add has no parameters, add default remote #100 #141
* When add has 'upstream' parameter, add the upstream remote #99 #141
* Use default branch instead of hardcoded 'master' #91
* Refactor and complete bitbucket support #43 #11 #80 #14 #89 #90 #79
* Loosen versions of dependencies #133
* Report if the service is already setup #136
* Adds GitBucket support #142 #144
* Adds support for ssh:// URL #148

🚒 Bugfixes

* fix various crashes #152
* fix gitlab clone crash #129
* fix request create command #147 #127
* fix request fetch command #138 #131
* fix wizard crash #149
* fix mishandling of renamed gitlab project urls #137

📝 Documentation

* documentation #145

Signed-off-by: Guyzmo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants