gitless icon indicating copy to clipboard operation
gitless copied to clipboard

How to associate my github account?

Open pepa65 opened this issue 7 years ago • 10 comments
trafficstars

I thought gitless sounded like a great idea, so I proceeded to download the binary and initialize a local repo, and put some files in. Then I wanted to push this to a new repo on my github account, so I tried gl remote -c qq https://github.com/pepa65/qq, but that never completes.

What is the way to connect a local repo with a remote account?

pepa65 avatar Dec 15 '17 01:12 pepa65

This is a bug in Gitless. GitHub is probably asking you for a password and we should prompt you to input one like git does. A workaround is to use git when you need to interact with your remote (e.g, when you need to push or pull).

spderosso avatar Dec 15 '17 02:12 spderosso

Another thing you could do (I did it last semester, when I was intensively using gitless) is to configure git to cache your password for a given time. It’s secure, and local. But the great thing about it is this: you use git “something something” once, enter your credentials, and then until the cache expires, gl works perfectly using git’s cache :3

I don’t remember the configuration commands, but you can google it :) I’m sure you can find it, this is a common use case ^^

On Thu, Dec 14, 2017 at 11:23 PM Santiago P De Rosso < [email protected]> wrote:

This is a bug in Gitless. GitHub is probably asking you for a password and we should prompt you to input one like git does. A workaround is to use git when you need to interact with your remote (e.g, when you need to push or pull).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sdg-mit/gitless/issues/160#issuecomment-351895015, or mute the thread https://github.com/notifications/unsubscribe-auth/ALNBJ92T5ZqbnZUmaToQIGYlqk9_v26rks5tAdgbgaJpZM4RC4iy .

felix91gr avatar Dec 15 '17 02:12 felix91gr

This seems to be it:

git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=3600'

But now it says:

✘ remote: Repository not found.
fatal: repository 'https://github.com/pepa65/qq/' not found

If I create the repo by curl -u pepa65 https://api.github.com/user/repos -d '{ "name": "qq" }' and then do gl remote -c qq https://github.com/pepa65/qq it comes back ✘ Remote 'qq' already exists....

If I then do gl publish it says:

! No dst branch specified, using upstream branch master
✘ Can't publish to a local branch (yet---this will be implemented in the future)

pepa65 avatar Dec 15 '17 02:12 pepa65

If you do gl branch what do you see? What's the upstream branch of your local branch master? I think that you probably want it to be qq/master (assuming qq is the name of your remote)

If you do gl branch -su qq/master and then try gl publish, does it work?

spderosso avatar Dec 15 '17 02:12 spderosso

gl branch:

List of branches:
  ➜ do gl branch -c b to create branch b
  ➜ do gl branch -d b to delete branch b
  ➜ do gl switch b to switch to branch b
  ➜ * = current branch

    * master 

gl branch -su qq/master gives ✘ Remote "qq" doesn't exist, and there is no local Branch "qq/master"

I am starting to think that gl remote -c qq https://github.com/pepa65/qq is not the right command. What would be better, if I want to start a remote github repo to store my newly made local git(less) repo?

pepa65 avatar Dec 15 '17 02:12 pepa65

(In addition, gl remote -c qq https://github.com/pepa65/qq now comes back with:

✔ Remote qq mapping to https://github.com/pepa65/qq created successfully
  ➜ to list existing remotes do gl remote
  ➜ to remove qq do gl remote -d qq

)

pepa65 avatar Dec 15 '17 02:12 pepa65

Oh I see what happened. Your remote repo is empty. It looks like you hit another bug, sorry about that!

You can do git push qq master to push your master branch and after that gl branch -su qq/master should work

spderosso avatar Dec 15 '17 03:12 spderosso

Actually, this is not necessarily a bug. The problem is that there is no qq/master branch because your remote repo is empty. You can do gl branch -c qq/master to create a master branch in qq

spderosso avatar Dec 15 '17 03:12 spderosso

The following sequence of commands should work:

gl remote -c qq https://github.com/pepa65/qq
gl branch -c qq/master
gl branch -su qq/master

spderosso avatar Dec 15 '17 03:12 spderosso

OK, and precede all that with curl -u pepa65 https://api.github.com/user/repos -d '{ "name": "qq" }' otherwise you get:

✘ remote: Repository not found.
fatal: repository 'https://github.com/pepa65/qq/' not found

Maybe a new subcommand newremote could be conceived that does all these things in one go, like: gl newremote https://github.com/pepa65/qq..!

pepa65 avatar Dec 15 '17 03:12 pepa65