x-motemen / ghq Goto Github PK
View Code? Open in Web Editor NEWRemote repository management made easy
License: MIT License
Remote repository management made easy
License: MIT License
This looks similar to #165, but instead of a dangling symlink, I have directories which are root owned. It's probably a little odd, but I have my GHQ_ROOT set to the root of a macOS volume. In there are several root owned directories (.Trashes
, .Spotlight-V100
and .fseventsd
).
In my opinion, skipping over inaccessible directories, or possibly directories starting with a dot would be a good idea. As is, after updating my ghq, no operations work anymore:
ghq get https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
error open /Volumes/code/.Spotlight-V100: permission denied
After disabling spotlight indexing and removing that directory, the next one is .Trashes:
$ ghq list
error failed to filter repos while walkLocalRepositories(repo): open /Volumes/code/.Trashes: permission denied
Some of the projects I work on are stored in private git repos where the SSH daemon is listening to a custom port. When using ghq, I noticed that the folder created by ghq contains :<port_number> which is not desirable IMO.
Refer
https://gist.github.com/shigemk2/21969d6a47aaec2e5073
I want to show symlink of github repository by executing "ghq list", but I couldn't.
Hi,
I'd like to clone some repository containing submodules.
With git, submodules can be cloned by git clone --recursive
.
But ghq get
does not look to have --recursive
option.
How to clone submodules in a repository?
Hello, @motemen
I think it's a good idea to set root command --all
flag true by default.
Currently, we can show all repositories root like this.
$ ghq root --all
But by default, $ ghq root
always shows a one repository root.
It may cause a little bit to confuse because we can configure ghq.root
more than one.
Given that we can force the vcs in the gitconfig, it'd be nice to be able to specify it on the ghq get
command-line and have it automatically store that information in gitconfig for us. That was the first place I looked when wanting to explicitly set the vcs, and only found the configuration via re-reading the README.
I understand this would add a significant amount of code to this project, but I think it would be really nice to be able to search Github for a repo and import the first result (maybe after confirmation).
Ex:
$ ghq get ghq
would search Github for ghq and import this project without having to type:
$ ghq get motemen/ghq
I noticed installing like this: go get github.com/motemen/ghq
gets me ghq version is 0.7.6, but there's only releases up to 0.7.4.
git-extras has a fork then clone command that'd be handy to add here as well.
I realize it would be a bit difficult to make it non Github-specific but I'd be more than happy with just Github support for starters.
EDIT:
ghq get -f <github_repo
for syntax would be awesome.
On Windows the 'look' command uses COMSPEC so it will start a cmd.exe shell. If the user is working in a PowerShell shell this is not what they'd want to do.
I expected it just to 'cd', but starting a new shell makes sense. Could there be a way to override this by checking for a GHQ_SHELL variable before checking COMSPEC?
Installation with 'go get' does not complete on Ubuntu Server 19.04.
My environments are ...
$ go version
go version go1.10.4 linux/amd64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
Codename: disco
This is how to install ghq with 'go get'
go get github.com/motemen/ghq
# github.com/motemen/ghq
go/src/github.com/motemen/ghq/local_repository.go:265:19: undefined: os.UserHomeDir
Anyidea do you have?
I want do like this:
$ ghq list > ghqlist.txt
# copy ghqlist.txt to another machine
$ cat ghqlist.txt | ghq import
Is there proper options for ghq list
or ghq import
?
I want to gitter room for this repository, ghq because I want to talk about ghq questions.
Is there any demand for gitter room?
I want do like this:
$ gogh list > ghqlist.txt
$ cat ghqlist.txt | gogh get
I should that gogh can solve it.
introduce: #92
The ghq list [<query>]
command stops listing matches when a non-directory. This is not a show-stopper, but it was making me think I had lost my mind this morning, when I would successfully ghq get …
then a ghq list jps3/
would stop listing items after the first few. Sometime in the past few days it appears I mistakenly edited a text file in the ~/.ghq/github.com/jps3/
directory, and I noticed that in normal sorting it came right after the first few items which were being returned with ghq list jps3/
. Once I removed that file, all was right in my ghq
world again.
Found/tested on OS X 10.10.5 (14F27) and ghq
version 0.7.1 (installed via Homebrew).
Example:
$ ghq list motemen/
github.com/motemen/ghq
$ cd ~/.ghq/github.com/motemen
$ ls -l
total 0
drwxr-xr-x 27 jps3 staff 918 Sep 23 10:12 ghq
$ touch foo
$ ls -l
total 0
-rw-r--r-- 1 jps3 staff 0 Sep 23 10:14 foo
drwxr-xr-x 27 jps3 staff 918 Sep 23 10:12 ghq
$ ghq list motemen/
$
$ rm foo
$ ghq list motemen/
github.com/motemen/ghq
$ touch zoo
$ ls -l
total 0
drwxr-xr-x 27 jps3 staff 918 Sep 23 10:12 ghq
-rw-r--r-- 1 jps3 staff 0 Sep 23 10:16 zoo
$ ghq list motemen/
github.com/motemen/ghq
$ rm zoo
$ mkdir foo.d
$ ghq list motemen/
github.com/motemen/ghq
$ rmdir foo.d
Perhaps someone else has run into this and been a bit flummoxed as well. Also, maybe this is an easy one to fix (if so, you are welcome).
i set ghq.root in .gitconfig
, but ghq don't work..
my gitconfig is as follows.
[ghq]
root = ~/dev/src
root = ~/.go/src
i execute ghq root --all
command, ~/dev/src
is obtained....
Please tell me how to work correctly.
If we're using conditional includes in the global gitconfig (like this example), any git
commands run in different directories may have invalid responses.
It would be very useful if (in conjunction with #109) you could specify a the git.root
inside the VCS config block and then use that to cd
before any other commands.
Example:
# .gitconfig-work
[url "[email protected]:"]
insteadOf = gl:
insteadOf = ssh://gl/
insteadOf = https://gl/
# .gitconfig
[includeIf "gitdir:~/code/work/"]
path = .gitconfig-work
[ghq "gl:"]
root = ~/code/work
Please enable us to remove/delete a cloned repo through ghq
. Currently, I have to delete them manually. And if possible, I want to be able to remove an organization like github.com
, or an account under that organization, like github.com/singularitti/
. Thank you!
So I could not return to previous directory ( e.g $ cd -
)
$ cd ~/
$ ghq look github.com/YumaInaura/dotfiles
cd /Users/yuma/.ghq/github.com/YumaInaura/dotfiles
$ env | grep PWD
PWD=/Users/yuma/.ghq/github.com/YumaInaura/dotfiles
OLDPWD=/Users/yuma/.ghq/github.com/YumaInaura/dotfiles
I have reported it here for information, but I expect that it is a kind of "wontfix" issue because it occurs in an abnormal environment.
mkdir foo
in one terminalrmdir foo
in another terminalghq root
in the first terminaloutput:
fatal: Unable to read current working directory: No such file or directory
panic: exit status 128
goroutine 1 [running]:
github.com/motemen/ghq/utils.PanicIf(0x124f700, 0xc42008ad80)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/src/github.com/motemen/ghq/utils/log.go:53 +0x4a
main.localRepositoryRoots(0x3, 0xc42006c660, 0x119b600)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/local_repository.go:195 +0x485
main.primaryLocalRepositoryRoot(0xc4200906e0, 0x119b2b8)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/local_repository.go:219 +0x22
main.doRoot(0xc4200906e0, 0x0, 0xc4200906e0)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/commands.go:453 +0x158
github.com/urfave/cli.HandleAction(0x116ab00, 0x11a5c98, 0xc4200906e0, 0xc42006c600, 0x0)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/src/github.com/urfave/cli/app.go:490 +0xd4
github.com/urfave/cli.Command.Run(0x119b4e1, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x119f53e, 0x17, 0x0, ...)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/src/github.com/urfave/cli/command.go:210 +0xb6e
github.com/urfave/cli.(*App).Run(0xc420052ea0, 0xc42008a080, 0x2, 0x2, 0x0, 0x0)
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/src/github.com/urfave/cli/app.go:255 +0x76f
main.main()
/private/tmp/ghq-20170822-8571-7p2dyy/ghq-0.8.0/main.go:12 +0x53
Trying out the new release and in the Windows amd64/386 zips there is no ghq.exe file. Renaming the file (ghq -> ghq.exe) seems to work fine.
ref #183
go getでインストールしようとしたところ
~/.go/bin$ go get github.com/motemen/ghq
# github.com/motemen/ghq
../src/github.com/motemen/ghq/commands.go:37: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:38: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:39: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:55: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:56: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:57: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:88: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:89: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:90: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:103: too few values in struct initializer
../src/github.com/motemen/ghq/commands.go:103: too many errors
と出てきてしまい、インストールすることができませんでした。
https://github.com/codegangsta/cli
こちらの影響ぽかったので、tag: 1.1.0に戻すとインストールすることが出来ました。
直していただけると助かります。
I can write gem 'rails', :github => 'rails'
in Gemfile
.
Similarly, I want to ghq get rails
instead of ghq get rails/rails
.
http://bundler.io/v1.6/git.html says
If the repository name is the same as the GitHub account hosting it, you can omit it
While the look command is useful, spawning a new shell is less than ideal for scripting, so a sub-command which simply returns the path on disk would be useful.
similar #171
Instead of doing this:
ghq get [email protected]:20022/group/project.git
I want to do this:
ghq get my-repo-server.example.com/group/project
I'ts similar to what GIT's url.<base>.pushInsteadOf
does but more powerful
and specifically for GHQ.
The URL in [ghq "my-repo-server.example.com/"]
becomes a simple prefix string
matcher which then looks at match/replace to construct the final URLs.
Conceptually it could work something like this but there are probably more use
cases to think about.
[ghq "my-repo-server.example.com/"]
vcs = git
match = my-repo-server.example.com/(?P<rest>.*)/+
replace = [email protected]:20022/${rest}.git
Forcefully overriding https with .git:
[ghq "https://my-repo-server.example.com/"]
vcs = git
match = https://my-repo-server.example.com/(?P<rest>.*)/+
replace = [email protected]:20022/${rest}.git
And configure sub paths of hosts to be translated where the longest match wins(?):
[ghq "github.com/"]
vcs = git
match = github.com/(?P<rest>.*)
replace = https://github.com/{rest}
[ghq "github.com/thomasf/"]
vcs = git
match = github.com/thomasf/(?P<rest>.*)/+
replace = [email protected]:thomasf/{rest}.git
I'm using ghq get
command, but there are some errors as below.
error Could not find version control system: https://hogehoge.com/hogehoge
How do I do to fix this error?
Recent ghq does not work with multiple ghq.root with nonexistent directory.
I use first ghq.root only. Second ghq.root for ghq list
after I use go get
.
I don't know which ghq version does not work.
At least, old ghq works well.
environment:
macOS Mojave and install ghq using homebrew
% sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.4
BuildVersion: 18E226
% brew info ghq
ghq: stable 0.12.1 (bottled)
Remote repository management made easy
https://github.com/motemen/ghq
/usr/local/Cellar/ghq/0.12.1 (7 files, 8.0MB) *
Poured from bottle on 2019-05-08 at 21:37:47
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/ghq.rb
==> Dependencies
Build: go ✘
==> Caveats
zsh completions have been installed to:
/usr/local/share/zsh/site-functions
==> Analytics
install: 2,103 (30 days), 2,943 (90 days), 6,643 (365 days)
install_on_request: 1,940 (30 days), 2,771 (90 days), 6,406 (365 days)
build_error: 0 (30 days)
% git config --get-all ghq.root
/Users/kazu/s
/Users/kazu/g/src
% ghq --version
ghq version 0.12.1 (rev:)
expected:
ghq get https://github.com/motemen/ghq
clone to ~/s/github.com/motemen/ghq
.
actual:
% ghq get https://github.com/motemen/ghq
error lstat /Users/kazu/g/src: no such file or directory
I found ghq list
does not work too.
% ghq list
error failed to filter repos while walkLocalRepositories(repo): lstat /Users/kazu/g/src: no such file or directory
Homebrew/homebrew-core repository can't take in ghq v0.9.0 because v0.9.0 is not the latest release:
Could you make v0.9.0 release?
Set relative paths in .gitconfig
[ghq]
root = ~/.go/src
root = ./vendor
Run ghq list
with --full-path, -p
option
$ cd /path/to/some/golang/repo
$ ghq list -p
/Users/delphinus/.go/src/github.com/mattn/gom
/Users/delphinus/.go/src/github.com/mattn/gover
/Users/delphinus/.go/src/github.com/mattn/goveralls
...
vendor/github.com/BurntSushi/toml
vendor/github.com/urfave/cli
I think the last two paths should be absolute, such as...
/path/to/some/golang/repo/vendor/github.com/BurntSushi/toml
/path/to/some/golang/repo/vendor/github.com/urfave/cli
Is it the specification, or the bug?
I just really wonder what GHQ stands for. It will help me remember the command to type in the terminal.
I'm currently using insteadOf to alias my company's gitlab instance and force SSH like this:
[url "[email protected]:"]
insteadOf = gl:
insteadOf = ssh://gl/
insteadOf = https://gl/
This mostly works when using ghq
, except that the directory name is created before running git ls-remote
.
Actual/Expected output shown in the diff below:
$ ghq get gl:foo/bar
clone ssh://gl/foo/bar -> /Users/fotios/src/gl/foo/bar
git clone ssh://gl/foo/bar /Users/fotios/src/gl/foo/bar
- Cloning into '/Users/fotios/src/gl/foo/bar'
+ Cloning into '/Users/fotios/src/gitlab.mycompany/foo/bar'
This can also be used instead to augment specifying -p
since insteadOf
can be used to force HTTPS/SSH depending on the path.
It would be cool if ghq look
just ran cd ...
instead of going into a subshell. (The subshell feature annoys me actually...). Or at least add a configuration for it?
When giving a username along with repo URL (both using HTTP(S) or SSH) it gets reverted to git
if SSH is preferred using -p
switch.
This has no actual effect with Github, but manifests with custom - especially on-site hosted - repositories and their access control.
It would be handy if ghq could open the project page that corresponds to a repository in a browser. For example:
% ghq get -p foo/proj1
% ghq look foo/proj1
% ghq browse # opens up a browser
and/or simply
% ghq browse foo/proj1
from anywhere outside the repo.
There are a few considerations though:
What do you think?
Hi, @motemen,
Now ghq's configuration gets complex.
Currently ghq's configuration rents a space from git-config, but I think that it's a time to make the configuration file for ghq.
Have you thought about separating ghq configuration from git-config to another configuration file? ($HOME/.ghqconfig
or something)
It take about 5 seconds now:
real 0m5.194s
user 0m2.436s
sys 0m2.172s
360 entries listed
I quickly tried using https://github.com/MichaelTJones/walk which helps a bit:
real 0m1.755s
user 0m3.208s
sys 0m2.064s
360 entries listed
Reverting back to 53c4cae (bump version to 0.7.3) the speed is up again:
real 0m0.028s
user 0m0.004s
sys 0m0.012s
355 entries listed
For most situations I rather go back to the old behaviour in most situations if it isn't possible to solve this somewhere else.. Maybe adding an option to stop traversal is a good idea?
I also tried using MichaelTJones/walk on 53c4cae but that only listed one repository so it's not working well there.. I havent had time to really read through the changes now so I'll be using 53c4cae as a temporary workaround.
This occurs, for example, when the following command is executed.
% ghq get golang.org/x/crypto/md4
In this case, the contents of x/crypto
should be cloned under the crypto/
directory, but will be cloned under the md4/
directory.
I tried ghq_darwin_amd64.zip v0.4. But it shown runtime.panic
.
I expected binary package does not need go runtime, should I install go runtime?
$ ./ghq get https://github.com/motemen/ghq
panic: user: Current not implemented on darwin/amd64
goroutine 1 [running]:
runtime.panic(0x2d9d60, 0x210874e40)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/motemen/ghq/utils.PanicIf(0x802e80, 0x210874e40)
/home/ubuntu/go/src/github.com/motemen/ghq/utils/log.go:50 +0x4f
main.localRepositoryRoots(0x5aab2, 0x21087ac72, 0x4)
/home/ubuntu/go/src/github.com/motemen/ghq/local_repository.go:174 +0xf1
main.walkLocalRepositories(0x22109a3950)
/home/ubuntu/go/src/github.com/motemen/ghq/local_repository.go:126 +0x1e
main.LocalRepositoryFromURL(0x2108935b0, 0x2108935b0)
/home/ubuntu/go/src/github.com/motemen/ghq/local_repository.go:58 +0x29c
main.getRemoteRepository(0x8034a0, 0x210832370, 0x210830000)
/home/ubuntu/go/src/github.com/motemen/ghq/commands.go:184 +0x4e
main.doGet(0x210895160)
/home/ubuntu/go/src/github.com/motemen/ghq/commands.go:176 +0x2f9
github.com/codegangsta/cli.Command.Run(0x371e60, 0x3, 0x0, 0x0, 0x3ca190, ...)
/home/ubuntu/go/src/github.com/codegangsta/cli/command.go:97 +0xbde
github.com/codegangsta/cli.(*App).Run(0x210896000, 0x21083c000, 0x3, 0x3, 0x21f50, ...)
/home/ubuntu/go/src/github.com/codegangsta/cli/app.go:125 +0x901
main.main()
/home/ubuntu/go/src/github.com/motemen/ghq/main.go:12 +0x52
@motemen suggestion: make import starred/pocket a separate program. Easier to maintain, no need to re-build etc. #ghq
https://twitter.com/miyagawa/status/480950493837926403
% go get -u github.com/motemen/ghq
# github.com/motemen/ghq/utils
.gvm/pkgsets/go1.10/global/src/github.com/motemen/ghq/utils/log.go:10:19: too few values in struct initializer
I'm not really sure which to report this issue but I'm using your ghq and not go-homedir thus I decide to report the issue here.
Well, when I tried to install this program by go get github.com/motemen/ghq
, the command fail with
../../../.go/src/github.com/mitchellh/go-homedir/homedir.go:18: undefined: atomic.Value
It seems that the atomic.Value
feature was implemented from Go 1.4, and I'm using Go 1.3.3 which is available on Ubuntu 15.04 (ref, the use was implemented in go-homedir at this commit)
So I'll be really happy if you decide to support Go 1.3, which can be installed through apt-get
.
I'd like to propose a flag to go to the cloned repository just after get
command.
So instead of running, for example:
ghq get [email protected]:user/project
ghq look [email protected]:user/project
We ran just (supposing this new flag is -l
)
ghq get -l [email protected]:user/project
I can propose a PR for that if convenient.
It'd be nice to be able to filter working directories by VCS.
This is useful in the case to run git-gc on all local Git repositories.
for line in $(ghq list --full-path --vcs=git); do
git gc --aggressive
done
Please tell me your opinions.
If my request be accepted, I will prepare PR to support this feature.
Currently ghq.root
defaults to ~/.ghq
, which seems not convenient very well. Can we have more-suitable default value?
Or showing a prompt to configure ghq.root
on first startup of ghq
?
Currently, I am having following message, whenever I execute ghq related command.
DEPRECATED Action signature. Must be `cli.ActionFunc`. This is an error in the application. Please contact the distributor of this application if this is not you. See https://github.com/codegangsta/cli/blob/master/CHANGELOG.md#deprecated-cli-app-action-signature
It's just because codegangsta/cli a dependent library of ghq was updated.
Do you have any idea how I can get rid of this message?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.