Git

One line command to create SSH keygen

Go to ~/.ssh first and run the following command:

ssh-keygen -b 1024 -t rsa -f id_rsa -P ""

 

Multiple git accounts require different ssh keys

If you have 2 BitBucket git accounts, you are not allowed to use the same ssh key in both accounts. As we know, you will keep receiving an error message without ssh key set up correctly.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

To fix it, you need config ssh and git remote. Here are the steps:

step1: you need create a config file under .ssh

Fix the problem 'Could not read from remote repository'

Even you have generated a SSH KEY and added it to github or bitbucket, it still returns the error below:

conq: repository access denied.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The solution is after add ssh key, add you ssh key to ssh agent too (from oficial docs https://help.github.com/articles/generating-ssh-keys/)

Git permission revert

Have you ever been in the situation where you changed file permissions on some files within a certain git repository and where you'd like to reset the permissions, but you can't use git checkoutbecause you don't want to lose actual changes to the file?

Here's a handy command I found online:

Set up drupal with git

You can now provision your other tiers with this code from the repository.

Log into your server and provision a development environment from the code you’ve committed:

git clone --branch fooproject ssh://fooproject@fooproject.com/home/users/fooproject/fooproject.git fooproject_dev

 

Enable .gitignore file

Running command: 

git rm -r --cached .

This removes everything from the index, then run:

git add .

Commit it:

git commit -m ".gitignore is now working"

Set up drupal with git

You can now provision your other tiers with this code from the repository.

Log into your server and provision a development environment from the code you’ve committed:

git clone --branch fooproject ssh://fooproject@fooproject.com/home/users/fooproject/fooproject.git fooproject_dev

 

Enable .gitignore file

Running command: 

git rm -r --cached .

This removes everything from the index, then run:

git add .

Commit it:

git commit -m ".gitignore is now working"