my code stock.com

Tipps und Tricks um Umgang mit Bash/Shell

Snippet options

Download: Download snippet as git-bash.sh.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

# Get your current git status (not from your user, these are different things)
git status

# Hilfe
git add --help
# ODER
git help add

# Will give you a list with all details abour your configuration
git config --list

# start the SSH keyagent via terminal / console
## spits back the Agent's ID as a number
eval $(ssh-agent)


# Shows your local configuration
ssh -v localhost

# Connect to a server via ssh
ssh [email protected]

# Then you will be asked for a password

# Navigate > one level up
cd .. 

# level to path
cd path/to/folder

# The use of the tilde (~) represents the current user’s home directory.
cd ~


#  ls is the list command, and -alh modifies the standard list in three ways. a means that all files, even hidden files, should be shown. l means that the long format is used - it shows things like file size and the date every file was last modified. h makes the sizes display in convenient units. Here's some sample output:
ls -alh

# or you can do

ls -la

# delete file
rm filename.ext

# delete a folder, -r = rekursive / basically, go deeper into each folder
rm -r foldername

# create a folder
mkdir newfoldername

# Generate keypair - the "rsa" is the type of key
ssh-keygen -t rsa

# Then use this command to push the key to the remote server, modifying it to match your server name.
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'

# Generate a key and add a comment to it
ssh-keygen -C 'Your comment for the key'

#tree module
tree

# Show remote git url
git remote -v

# create a new file and open it
vi filename

###########################################################################################################################################################################
################################################################# ssh-copy-id [email protected] >>> Hit that shit - best method
###########################################################################################################################################################################
ssh-copy-id [email protected]


# Neues Repository erstellen, z.B. [email protected]:rgmarketing/oxxo-wp-theme-2016.git
git init <repositoryname>

# Give permissions on a certain file
chmod +x post-receive

# The -v flag (for verbose)
-v 

# Video zum generellen Thema authefizierung
# https://www.youtube.com/watch?v=DbPDraCYju8


# Add a new so called "remote" server
git remote add yourBranchname ssh://[email protected]/full/path/to/repository/projectname.git

# Example
ssh://[email protected]/var/www/repos/repositoryname.git

# dploy.io https://www.youtube.com/watch?v=eQpIomFi2uM

# (trennt .git Ordner vom Code physikalisch)
git init --bare

#  -f stands for / to force checkout
git checkout -f

#  Create a new file and open it
vi filename

#  or

touch filename


#  Best Best Best
# https://www.youtube.com/watch?v=9qIK8ZC9BnU

#If you're getting permission denied from Github's end, it could be that it's not picking up your copied SSH key file, but rather the system default. An easy way around this is to great a ~/.ssh/config file and put the following in it:

Host github.com
  Hostname      github.com
  User          git
  IdentityFile  ~/.ssh/yourkeyfile
  
#This will force your SSH client to use that key for github.com only.

# config für Shortcuts beim login, diese befindet sich in ~/.ssh/YOUR_PRIVATE_KEY
Host amazon1
    HostName ec2.amazon.com
    User ec2-user
    IdentityFile /path/to/special/privatekey/amazon.pem
    

# Check Permissions

id <username>


Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.