Using GitHub with Cygwin After Setting Up an RSA Key and a User
Posted on June 17, 2014 in Command Line, GitHub, Linux by Matt Jennings

Open Cygwin and navigate to the parent directory or where your repositories are located.

  1. If needed type chgrp Users * and press Enter to ensure that all of the repositories in that parent directory are added to a user group.
  2. Change the permission for your repository to 700 like the example below:
    chmod 700 myGitHubRepository
  3. To ensure that the permission of your myGitHubRepository directory was changed to 700, type ls -al and press Enter to see a list of all directories, including additional information like their permissions and group memberships.
  4. Then you should see something like below on the line that contains information for your myGitHubRepository.The drwx------ text refers to a permission of 700 where only the yourUserName user can read, write and execute the files in the myGitHubRepository directory. See this article on Unix and Linux permissions by William E. Shotts, Jr. for more details.
    drwx------+ 1 yourUserName	Users	0 Jun 17 14:46 myGitHubRepository
  5. Type git push -u origin master and press Enter to ensure that you will be able to push the master branch of the myGitHubRepository to your GitHub account. You will need to enter your GitHub username and password. If everything works correctly you should see a confirmation message like below:
    Everything up-to-date
  6. Now you will only need to type git push, press Enter and type your GitHub username and password and your myGitHubRepository master branch will be pushed to your remote GitHub account.
  7. To create a new branch called codeTest type git branch codeTest and press Enter.
  8. To edit code in the new codeTest branch type git checkout codeTest and press Enter.
  9. To confirm that you are now in the codeTest branch type git branch and press Enter. You will now see text like below:
    * codeTest
  10. To commit the codeTest branch type the code below and press Enter. The “code test” text in the double-quotes is a comment that will eventually be submitted along with the codeTest branch to your remote GitHub account.
    git commit -a -m "code test"
  11. Type git push and press Enter to ensure that this codeTest branch is pushed to your remote GitHub account. You’ll see a success message that says something like:
    Everything up-to-date
  12. To see your current Git status type git status and press Enter. Some of your output text may say On branch codeTest.
  13. While still in the codeTest branch, edit a file. Then to get that file ready to push to your remote GitHub account type git checkout and press Enter. If you edited an index.html file you’ll see something like the output text below:
    M	index.html
  14. To commit the modified index.html file of your codeTest branch to your your myGitHubRepository, type git commit -a -m "another update" (once again the "another update" text is a comment that will be pushed with the modified branch) and press Enter.
  15. To push the modified index.html file of your codeTest branch to your your myGitHubRepository on your remote GitHub account, type git push and press Enter.
  16. To ensure you don’t need to enter passwords every time you do a push, make sure you are in the the your myGitHubRepository directory and type cd .git and press Enter. Then if you have Gnu nano (command line text editor) installed type nano config to edit this file in your shell.
  17. Per this blog post from Sneek Digital, replace the text similar to url = with the new text below:
    url =
  18. After making the changes to the config file, press Ctrl + x, then type yes and press Enter and finally press Enter to fully save the file and exit it.
  19. Navigate back to your myGitHubRepository directory. Type ssh-add and press Enter. Then you’ll see Enter your passphrase for[more characters here]rsa: text output. Type your RSA key password and press Enter.
  20. To ensure that you don’t need to enter your password every time you push a branch to your remote GitHub account, type git push and press Enter. Hopefully you won’t need to enter a password.
  21. Finally, to switch back to the master branch type git checkout master and press Enter. Then when you type git branch and press Enter you see something like this output:
    * master

Leave a Reply

To Top ↑