Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Wednesday, January 27, 2016

How to connect a non-empty directory into a git repository

  1. Open the Command Prompt (Windows)/Terminal (Linux)
  2. Go to folder location
  3. Type the following commands:

    git init
    git add -A .
    git remote add origin {url}
    git fetch
    git pull {url} master
    git commit -m "{message}"
    git push -u origin master
{url} is the location of your bare repository
{message} is any message that you want to identify the commit

Example:

I want to connect the c:\workspace\luizcgjr to the http://github.com/blogger/luizcgjr repository
  1. Open the Command Prompt (Windows)
  2. Type
  3. cd "c:\workspace\luizcgjr"
    git init
    git add -A .
    git remote add origin http://github.com/blogger/luizcgjr
    git fetch
    git pull http://github.com/blogger/luizcgjr master
    git commit -m "Added luizcgjr project to the repository"
    git push -u origin master
Source: http://stackoverflow.com/questions/3311774/how-to-convert-existing-non-empty-directory-into-a-git-working-directory-and-pus

Friday, December 25, 2015

How to fix The server's host key is not cached in the registry. You have no guarantee that the server is the computer you think it is when Fetch/Pull/Push in SourceTree

Issue when you click Show Full Output

git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 2048 ...
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without

adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.

Fix

  1. Open command prompt and type:
    "C:\Program Files (x86)\ Atlassian\SourceTree\tools\putty\plink.exe" {server} 
  2. Accept to store key in cache
  3. Type the username to connect to the server
  4. Type the password
  5. Close command prompt
  6. Try to Fetch/Pull/Push again
{server} is where the GIT server is located

Example:

"C:\Program Files (x86)\ Atlassian\SourceTree\tools\putty\plink.exe" www.blogger.com

Source: http://stackoverflow.com/questions/32437659/cannot-pull-git-remote-repository-from-sourcetree

Thursday, August 13, 2015

How to overwriting local changes in GIT using Sourcetree


  1. Open Sourcetree
  2. Open repository 
  3. At the ribbon bar, click Terminal


  4. At the terminal window, type the following commands:

    git fetch --all
    git reset --hard {remote branch} (example: origin/master)
    git pull origin master