gitgithub

Rename file with Git


I would like to rename file from README to README.md. What is the best practice to do that?


I have only one repo called "change-z-index".

  1. I open and login like that:

    ssh -T git@github.com
    

And I enter my passphrase.

  1. I try to rename the file like that:

    git mv README README.md
    git commit -m "renamed"
    git push origin master
    

It gives me an error saying bad source.

I think I need to select my repo first... its name is "change-z-index". I have read manual many times, but still can't understand how to do it.


Solution

  • As far as I can tell, GitHub does not provide shell access, so I'm curious about how you managed to log in in the first place.

    $ ssh -T git@github.com
    Hi username! You've successfully authenticated, but GitHub does not provide
    shell access.
    

    You have to clone your repository locally, make the change there, and push the change to GitHub.

    $ git clone git@github.com:username/reponame.git
    $ cd reponame
    $ git mv README README.md
    $ git commit -m "renamed"
    $ git push origin master