Git keep asking for my username and password on GitHub

If you’re experiencing this problem maybe you’ve made the checkout with the http or https url, that means that you dont have an authentication method.

For linux or Mac you can solve it with a simple way.

Mac:

    git config --global credential.helper osxkeychain

Linux:

    git config credential.helper cache

Reference for cache options on this link http://git-scm.com/docs/git-credential-cache

If you’re on windows and you’re trying to use cache the cache helper you might have the next message:

    git: 'credential-cache' is not a git command. See 'git --help'.

So in that case you need to setup the ssh connection and change your remote protocol connection from http to ssh. To do that you need run:

    git remote set-url origin git@github.com:username/repo-url-on-github.git

You also need to setup your ssl-key you can do it from the GitHub config https://github.com/settings/ssh . If you don’t know how to generate ssh keys just follow these steps https://help.github.com/articles/generating-ssh-keys .

How to use Dropbox as a GIT repository

Don’t you ever setup another version control server, Mercurial, SVN, CVS, or any other you may know.

What is GIT?

“In software development, Git /ɡɪt/ is a distributed version control and source code management (SCM) system with an emphasis on speed. Initially designed and developed by Linus Torvalds for Linux kernel development, Git has since been adopted by many other projects.”

Git on Wikipedia

What is Dropbox

“Dropbox is a file hosting service operated by Dropbox, Inc., that offers cloud storage, file synchronization, and client software. Dropbox allows users to create a special folder on each of their computers, which Dropbox then synchronizes so that it appears to be the same folder (with the same contents) regardless of which computer is used to view it. Files placed in this folder also are accessible through a website and mobile phone applications.”

Dropbox on Wikipedia

How to setup a GIT repo into your Dropbox account

Of course most of you already know what is GIT or Dropbox, so let’s start with the cool part of the post. Obiously you need to have Drobox and GIT installed on you PC or laptop.

1. First you need to create an empty folder on your Dropbox.

:~$ cd Dropbox
:Dropbox$ mkdir project_name

2. Init the remote folder into your local Dropbox

:Dropbox$ cd project_name/
:project_name$ git init --bare
Initialized empty Git repository in /Users/zantez/Dropbox/project_name/

Perform an ls command and you’ll see some folders

[BARE:master]:project_name$ ls
HEAD config description hooks info objects refs

3. Now lets clone the current GIT repository to a destination on your PC or laptop

:git$ git clone ~/Dropbox/project_name project_name_local
Cloning into 'project_name_local'...
warning: You appear to have cloned an empty repository.
done. 
:git$ cd project_name_local/ [master]:project_name_local$

4. Let’s perform an initial commit and push it into the origin

[master]:project_name_local$ ls test.txt
[master]:project_name_local$ git add -A
[master]:project_name_local$ git ci -m "initial commit"
[master (root-commit) 6916e97] initial commit 1 file changed, 0 insertions(+), 0 deletions(-) create mode
    100644 test.txt
[master]:project_name_local$ git push origin master Counting objects: 3, done.
Writing objects: 100% (3/3),
219 bytes, done. Total 3 (delta 0), reused 0 (delta 0)
To /Users/zantez/Dropbox/project_name * [new branch] master -> master

Now you’re all set, start working on your GIT project ;)

 

or maybe you need to….

Clone your local GIT repo into your Dropbox account

Thanks to @httpdss for this contribution.

Go to your dropbox folder and clone your local repo with the –bare option

git clone --bare ~/local_repo local_repo.git

Go to your local_repo folder and add dropbox git repo you’ve just cloned as a remote

git remote add dropbox ~/Dropbox/git/woow/sooprise_site.git

It’s done! but remember to push your local changes into dropbox remote.

git push dropbox master