I'm new to Git/Github and I needs some help. I would like to rename file from README to README.md. I have only one repo called "change-z-index".
1) I open and login like that:
ssh -T [email protected]
And I enter my passphrase.
2) 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... it's name is "change-z-index". I have read manual many times, but still can't understand how to do it.
Step 1: Open Git Bash. Step 2: Open the repository. Step 4: Use the “git status” command to check the changes. Step 5: Commit the renamed file.
Git keeps track of changes to files in the working directory of a repository by their name. When you move or rename a file, Git doesn't see that a file was moved; it sees that there's a file with a new filename, and the file with the old filename was deleted (even if the contents remain the same).
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 [email protected] 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 [email protected]:username/reponame.git $ cd reponame $ git mv README README.md $ git commit -m "renamed" $ git push origin master
Note that, from March 15th, 2013, you can move or rename a file directly from GitHub:
(you don't even need to clone that repo, git mv xx
and git push
back to GitHub!)
You can also move files to entirely new locations using just the filename field.
To navigate down into a folder, just type the name of the folder you want to move the file into followed by/
.
The folder can be one that’s already part of your repository, or it can even be a brand-new folder that doesn’t exist yet!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With