Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using alias to simplify clone

Tags:

git

I want to create an alias that looks something like this:

alias getres="git clone https://github.com/user/"

The goal is that i can type "getres repository name" and get the the repository.

However as it stands now,

typing "getres repository name"

Gives me an error saying the repostiory can't be found.

like image 223
mrmagin Avatar asked May 01 '26 15:05

mrmagin


1 Answers

This happens because getres repository name gets translated to:

git clone https://github.com/user/ repository name

which means you have a space character between https://github.com/user/ and repository name which completely mess with your URL.

The solution for your problem is to create a bash script which accepts 1 parameter (the repository name) then use that script in your alias.

see Make a Bash alias that takes a parameter?

like image 62
adrhc Avatar answered May 04 '26 22:05

adrhc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!