I was trying to create a new laravel app with laravel sail and I ran the following command on ubuntu 20.0.4:
curl -s https://laravel.build/example-app | bash
But I got the following message:
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
bash: line 16: cd: example-app: No such file or directory
Get started with: cd example-app && ./vendor/bin/sail up
Here is a screen shot
(No folder is created)
You are using a directory with capitals and spaces, i.e: Sennay Files. Use a different directory or rename it to: Sennay_Files.
You are working on the Windows file system from within WSL (i.e. /mnt/c). This will cause a significant performance hit, and issues like the one you are experiancing, consider using the WSL file system. You can change to the WSL file system by typing
cd ~
I am trying to start Bitnami AWS with Putty in mac, but when i start Auth in SSH with both Catalina and Big Sur i get this error:
(putty: 3637): Gtk-WARNING **: Attempting to set the permissions of `/Users/daniele/.local/share/recently-used.xbel ', but failed: No such file or directory
I tried to install the folder:
sudo mkdir -p /root/.local/share
I get this error:
mkdir: /root/.local/share: Read-only file system
As per the error message, we should create the folder at the following path:
/Users/daniele/.local/share/
And not:
/root/.local/share
Therefore, the correct command is:
mkdir -p /Users/Daniele/.local/share
Require the result in command: csrutil status
If result is enabled, you need to restart machine and press command + R, open the terminal in the recovery, so input csrutil diabled.
Restart, and check the status: csrutil status.
Here are two methods:
you are root.
sudo mount -uw /
so, you could mkdir or touch new file.
If you still can't read or write any, you maybe try this:
cd ~ # cd home directory
sudo vim /etc/synthetic.conf # create new file if this doesn't exist
In the conf files, add new line
data /User/xx/data # Notice: the space between this two strings is tab
Restart, and you will find a link named /data in the root.
This is the very first time for me to start deploying website using Linode. So now I am following a tutorial and after creating a user in server I am trying to create a folder using mkdir -p ~ /.ssh but I keep receiving mkdir: cannot create directory ‘/.ssh’: Permission denied
I am using Linode Ubintu and using Putty. So my question is why am I receiving this error and how do I fix it?
You have an extra space in your command:
mkdir -p ~ /.ssh
^ here
That space splits the path you wanted (~/.ssh) to the new 2 paths: ~ and /.ssh. Note that the second one is in the root (/) directory, which requires additional access rights to write in. But you most probably wanted to create .ssh in your home directory (to which the ~ leads), so proper command would be:
mkdir -p ~/.ssh
I am trying to use a bash (sh) script on windows to run a test deployment. I am running the script from the gitbash console so that I have a copy of bash, but doing so means that the azure clie is not available (i.e. azure command is not found). Does anyone know how I can get the Azure cli working in GitBash (I am assuming I just install it somewhere else) or should I change to a different way of using bash
Sometimes commands in windows git bash need .cmd appended. Also, another way of installing the Azure-Cli is through Chocolatey https://chocolatey.org/
Try this command after Azure-Cli is installed:
az.cmd --version
Echoing mscrivo you can run the line below in CMD not PowerShell (elevated/admin)
echo "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} > "C:\Program Files\Git\mingw64\bin\az"
Now you should be able to run in Git bash:
az --version
artberri noted the best solution in a comment:
Add the following to your %USERPROFILE%\.bashrc or %USERPROFILE%\.profile
alias az='az.cmd'
However, if you want to be able to use az in bash scripts, you'll need something a little more drastic, run the following from cmd prompt:
echo "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} > "%SYSTEMROOT%\az"
That will essentially create a passthrough az command in your windows folder that can be run from anywhere and passes parameters through to az.cmd.
In case using Git bash, navigate to the following directory:
C:\Program Files\Git\etc\profile.d
Edit aliases.sh, then add a new alias for az as below:
alias az='az.cmd'
You have to install the CLI to your computer.
There are multiple ways to do that.
I'm a friend of NodeJS so i use npm for the installation:
npm install -g azure-cli
More details here: https://www.npmjs.com/package/azure-cli
But you can do it also in other ways. A very nice way is to use docker. There are containers from Microsoft with a preinstalled version of Azure CLI.
docker run -it --name azure microsoft/azure-cli
On Windows 10 with the ubuntu bash you can use:
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main" | \
sudo tee /etc/apt/sources.list.d/azure-cli.list
sudo apt-key adv --keyserver packages.microsoft.com --recv-keys 417A0893
sudo apt-get install apt-transport-https
sudo apt-get update && sudo apt-get install azure-cli
Or as a python enthusiast run
pip install --user azure-cli
Most important is that the "az"/"az.bat" or "azure" bin is available via your path variable.
In other words Azure CLI for Windows is not compatible with Git Bash for Windows
https://github.com/Azure/azure-cli/issues/3445
In your ~/bin directory (in Windows it means c:\Users\<username>\bin) I've just created a file named az with:
"C:/Program Files (x86)/Microsoft SDKs/Azure/CLI2/python.exe" -IBm azure.cli "$#"
Then make the file executable
chmod a+x az
The content is "borrowed" from az.cmd.
When trying an alias approach mentioned before I had a problem with long commands, with a lot of parameters throwing an error
"'C:\Program' is not recognized as an internal or external command,operable program or batch file."
EDIT:
I've ended using Ubuntu through WLS. For all tools like az, terraform, kubectl, istioctl. The az tool runs good in interactive mode as well.
So I arrived here looking for a way to run the same az commands in a bash shell script on Azure DevOps Linux and Windows (git bash) build agents, so I could share the same code across both types of agent. This also works for a git bash shell on Windows 10. My longer answer is here: Azure DevOps Build Pipeline can't get secrets from Key Vault when secured with vnet and firewall
The gist of it is:
if [[ $(uname -s) == "Linux" ]]; then
azcmd="az"
else
# If we're in a bash shell on Windows, az commands don't work, but we can call the az.cmd batch file directly from git Bash if we can find it...
azcmd=$(where az.cmd)
fi
# Remember to specify CIDR /32 for removal
"$azcmd" keyvault network-rule remove -n <MyKeyVault> --ip-address 50.1.1.1/32
Basically just substitute "$azcmd" wherever you'd normally use az once the bootstrap code has executed.
My previous approach for this was just to add the Azure CLI Scripts folder to the $PATH inside my ~/.bashrc file. But, after updating Azure CLI to 2.2.0 via the MSI, this approach started to fail with this error:
C:\Program: can't open file 'Files': [Errno 2] No such file or directory
So, to fix this, I have my $PATH in ~/.bashrc include ~/bin and then I created a file with the following content as ~/bin/az (don't forget to chmod 0755 the new file):
#!/usr/bin/env bash
AZURE_CLI_PATH="/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2"
export PATH="${PATH}:${AZURE_CLI_PATH}:${AZURE_CLI_PATH}/Scripts"
export PYTHONPATH="${AZURE_CLI_PATH}/src"
export PYTHON_CMD="$(which python)"
winpty "${PYTHON_CMD}" -m 'azure.cli' "${#}"
After closing out my GIT Bash window and re-opening it, I can now run az again:
$ az version
This command is in preview. It may be changed/removed in a future release.
{
"azure-cli": "2.2.0",
"azure-cli-command-modules-nspkg": "2.0.3",
"azure-cli-core": "2.2.0",
"azure-cli-nspkg": "3.0.4",
"azure-cli-telemetry": "1.0.4",
"extensions": {}
}
Don't use the MSI installer at all. Since the Azure CLI is implemented in Python, use the Python installation method as #blndev wrote. This way instead of az.cmd you get az.bat and az shell script, and the installation path will not contain spaces.
pip install --user azure-cli
More detailed info on this method can be found at https://blogs.msdn.microsoft.com/brijrajsingh/2017/03/02/installing-azure-cli-2-0-on-windows/
The symlink worked for me most of the times, but some commands are still failing, e.g.
az dls fs access set-entry ...
'C:\Program' is not recognized as an internal or external command, operable program or batch file
I tried #mscrivo's solution. When using the az command in a shell script however you still have problems due to the spaces in the path.
Therefor I created a azproxy.cmd in %SYSTEMROOT% containing
#echo off
"C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" %*
And then create the mklink to that file
mklink "%SYSTEMROOT%\az" "SYSTEMROOT%\azproxy.cmd"
PS the expanded value of %SYSTEMROOT% should not contain spaces of course
gcloud compute copy-files /Users/myusername/Pictures/IMG_0382.JPG myusername#my-instance:/var/www --zone asia-east1-c
/Users/myusername/Pictures/IMG_0382.JPG: No such file or directory
ERROR: (gcloud.compute.copy-files) [/usr/bin/scp] exited with return code [1].
I am copy-pasting the file directory into my local terminal. What is the deal? Do I have to modify the .bash file or something?
So, it turns out I was not in the right terminal. Instead of ssh-ing into your instance and then issuing the command, you have to open up a fresh terminal window, cd to the appropiate directory (the folder with the desired upload file) and then issue the gcloud compute copy-files LOCAL... yada yada. If you are already connected to your instance, that's fine, just open up a new terminal window.
Does this command succeed or fail:
ls -ld /Users/myusername /Users/myusername/Pictures/IMG_0382.JPG
The copy and paste most likely did not do what you expected.
The GCP documentation can be found here.
To make it work I had to:
include sudo For permissions
delte the ~ specified in the documentation.
add zone of my VM
Code:
sudo gcloud compute scp [LOCAL_FILE_PATH] [INSTANCE_NAME]:/ --zone [INSTANCE ZONE]
Example
sudo gcloud compute scp /Users/jb/Downloads/cudnn-8.0-linux-x64-v7.tar instance-1:/home/jb --zone us-west