Posts Tagged ‘github’

Git push requires username and password

September 15, 2014 Leave a comment

You want to push a new project to github, but it asks for your username and password each time.

I found the solution here. Here I copy Davide‘s answer (reformulated a bit):

First, check the remote repository:

git remote -v

which will respond something like

origin (fetch)
origin (push)

Execute the following command:

git remote set-url origin

Notice that you need to do some transformations: “https://yourname@” is replaced with “git@“, and “/yourname” becomes “:yourname“.

Now “git push” should work fine.

Categories: Uncategorized Tags: ,

how to create a pull request on GitHub

June 20, 2014 Leave a comment

Explained step by step here:

In short: fork the repo you want to contribute to; clone it to your local machine; do the changes, commit, then push it back to your repo. Then create the pull request on the web interface of github: visit your repo and click on the “pull request” button. Fill out the necessary information and create the pull request. The project’s owner will be notified about your contribution.

Categories: Uncategorized Tags: ,

Find API keys on GitHub

March 4, 2013 Leave a comment

You need an API key for a service (like Google or Imgur) and you want to use someone else’s key. Naturally, this is just a theoretical problem.

This blog post shows how to harvest API keys. In short:

  • visit GitHub’s advanced search page
  • type in a keyword (for instance “AIza” for Google API keys)
  • hit the Search button and choose Code on the left side

GitHub: create a new repository and start using it

December 27, 2012 Leave a comment

You want to create a new GitHub repository and you want to use it right away, i.e. you want to upload some content.

In the past, GitHub showed a detailed step-by-step help for all this, but it got removed :(

On the main page of GitHub, there is a button called “New repository”. Click on it, fill out the fields and create the repo. Now it’s on GitHub.

The next step is to clone it on your local machine:

git clone

Here use the URL that starts with “”! Not the one with “https://“. Once I cloned the “https://” and then it kept asking my username and password at each commit :(

Now you can perform your local changes. When ready, upload the changes to github:

git push origin master

More info here.

Update (20131216)
If you need to upload your SSH key, follow this guide.

GitHub: contact watchers

September 7, 2011 Leave a comment

You want to contact all the watchers of a project. For instance, you want to notify them about some radical changes.

Simply click on the “Eye” icon that shows the number of watchers. It will list your followers.

Or, you can get the list of watchers through an API:

curl | python -mjson.tool

More info about the Repositories API: here. General information about the APIs: here.

Categories: Uncategorized Tags: , , , ,

README.markdown on GitHub

May 5, 2011 12 comments

For a quick and painless solution check out the last update at the end of the post.

When you create a project on GitHub, it is highly encouraged to add a README file too. Thus, when someone visits your project’s page, they will see the content of your README file automatically (example).

If you want, you can use the markdown syntax in your README files. In this case don’t forget to rename the file to README.markdown. It has the advantage that the output is much nicer while the source remains readable in a normal text editor too (example).

Update: You can also name the file as In the future I’ll use the .md extension, it’s shorter and simpler.

To learn more about the markdown syntax, refer to these links:


When I write a README.markdown file, I’d like to visualize it before uploading to GitHub. If there is a problem, I don’t want to commit this file several times. I’d like to refine it on my local machine and when it’s good, I want to upload it once.


I came up with the following Python script to visualize marked up files:

import os
import sys

MARKDOWN = 'markdown'
UPSKIRT = 'upskirt'


def main():
    update = False

    if len(sys.argv) < 2:
        print "Usage: {0} <file.markdown> [-u]".format(sys.argv[0])
    # else
    if '-u' in sys.argv:
        update = True
    input_file = sys.argv[1]
    os.system("{program} {input} > /tmp/markdown.html".format(program=PROGRAM, input=input_file))
    if not update:
        os.system("chromium-browser /tmp/markdown.html &")
    if VERBOSE:
        print >>sys.stderr, "# renderer: {0}".format(PROGRAM)


if __name__ == "__main__":

The up-to-date version of the script is available in this GitHub repository.

Usage: put it in your ~/bin directory (make sure ~/bin is in your PATH), make it executable (chmod u+x ~/bin/, and call it as “ README.markdown“. It will open the HTML output in a new tab. Adding the “-u” switch (update), the HTML is not opened in the browser.

Typical usage: call it first as “ README.markdown“, then add the “-u” switch and refresh the output in the browser.

Ref.: I saw this idea here but I couldn’t make it work with Ruby. I added the “-u” switch to make it easier to use.

Update (20110507)

First, I managed to install redcarpet. It was not easy… I wrote a post about it.

Second, if you want to use the GitHub flavored markdown, you don’t need to install redcarpet. I figured out later that redcarpet is just a Ruby wrapper for upskirt. So you can use upskirt directly. It’s written in C, just compile it and use the executable binary “upskirt“. This is integrated in the new version of the script (available here).

Update (20120212)
The “upskirt” project is gone from Github. It is replaced by sundown. Sundown is a fork of upskirt and this is the version used by Github too.

Update (20120219)
As it was pointed out by Teodor in a comment, the easiest way is to use the text editor ReText. It has a live preview function (Ctrl+Shift+E), thus editing Markdown or reStructuredTexts is made trivial. ReText is written in Python by the way.

Update (20141203)
I found an even nicer editor for markdown files: Remarkable. I write about it here.

Moving projects to GitHub

March 29, 2011 2 comments

A few days ago I decided to learn Git. This is something that I’ve had in my mind for a long time. Also, I will move my projects to GitHub (here is my profile page).

Useful links

Start with:

  • Pro Git book (Free, available in HTML. A very nice introduction.)

Read on:

Categories: Uncategorized Tags: ,

Get every new post delivered to your Inbox.

Join 73 other followers