Undo a clone in pythonanywhere - pythonanywhere

I have used git clone to clone a repository from GitHub. Now i have made some changes to that same repository, I want to clone it again, but Python anywhere has saved the earlier cloned repository and not allowing me to clone the updated one. Is there a way to undo/delete the earlier clone and copy the updated repository.

rm -rf cloned-repo is one way.
most likely though, you maybe want to just do a git pull? Or a git reset --hard and then git pull?
ps: I would suggest reading up on how git works.

My files were correct on local system and GitHub, but not on PythonAnywhere. What worked for me is the following:
Go to BASH Console on PythonAnywhere. Enter the command:
rm -rf <your-repo-name.pythonanywhere.com>
Go to Dashboard -> Accounts -> API Token -> Revoke and Generate new API Token (I am not sure if this is required, but I did it just in case)
Now you can get repository from GitHub to PythonAnywhere by NUKING the old running domain
pa_autoconfigure_django.py https://github.com/username/repo.git --nuke
Your github files will be now in pythonanywhere. And Virtual Environment will be created in the Bash console

Related

Does GitHub use bare repositories under the hood?

Recently, I discovered that git could be initialized with a --bare flag (e.g. git init --bare). It creates a local repository without a working tree (workspace). As far as I understand, such repositories can be used as a remote from which you can clone, pull and push.
Do GitHub and similar services use "bare repositories" under the hood?
I'm wondering because whenever I create a local repo and push it to a remote service (like GitHub, GitLab, Bitbucket, etc.), I don't create the bare repo myself and I'm not sure if it was created at all (implicitly by GitHub). If it wasn't created, then what is tracking the files/history?
tl;dr
Locally, I can do something like this
-- Step 1. Create a local bare repository
$ mkdir bare-repo/
$ cd bare-repo/
$ git init --bare
-- Step 2. Clone a non-bare repo and push changes
$ mkdir non-bare-repo-1
$ cd non-bare-repo-1
$ git clone ../bare-repo .
$ touch file.txt
$ git add .
$ git commit -m "Add file.txt"
$ git push (it pushes changes to the local remote a.k.a. non-bare/)
And I can create another folder and another and all of them will refer to a single (local) bare-repo/ which tracks changes of all cloned repositories.
I wonder if GitHub uses this approach under the hood, or if the bare repositories are used for something else...
Answering my own question
Do GitHub and similar services use "bare repositories" under the hood?
Yes
It looks like bare git repositories were designed to be used as remote instances and GitHub has to use them to get it to work.
P.S.
Related answer by #VonC
It seems that GitHub repository can work as working repository and bare repository at the same time, does that mean GitHub repository is developed from git bare repository
No, Git repos on GitHub are bare, like any remote repo to which you want to push.
Related answer by #duncan
Short answer
A bare repository is a git repository without a working copy, therefore the content of .git is top-level for that directory.
Use a non-bare repository to work locally and a bare repository as a central server/hub to share your changes with other people. For example, when you create a repository on github.com, it is created as a bare repository.
So, in your computer:
git init
touch README
git add README
git commit -m "initial commit"
on the server:
cd /srv/git/project
git init --bare
Then on the client, you push:
git push username#server:/srv/git/project master
...
I believe so. You can in fact create a GitHub repo and deselect all the auto created files (e.g. README.md, LICENSE). You're provided a list of instructions to init, commit and push the repo.

Upload to Heroku from GitHub other ways

As the GitHub linking is no longer working due to security issues, my app is still on GitHub and I want to put it on Heroku how do I do this easily?
As the security notification says, you can still deploy via git push.
Assuming you have a local copy of your repository¹ and you would normally do something like git push origin main to deploy to GitHub:
cd to your project directory
Check your remotes:
git remote -v
Do you see a Heroku remote?
If so, make note of its name and go to the next step.
Otherwise, add one:
heroku git:remote -a YOUR_APP_NAME
Now, push directly to the Heroku remote. Assuming it is called heroku:
git push heroku main
You'll probably also want to push to GitHub to ensure the code for your latest release is synced.
I believe this is the simplest option if you're migrating from GitHub integration, but the documentation also lists other options:
Docker-based deployments
Using dpl
Via Git hook
Via Terraform
¹If, for whatever reason, you don't have a local copy of your repository, git clone it from GitHub and then proceed as above.

Check and download difference.

I want check github repo and if is difference - download it.
How I can make it?
I will write bash script for it, but I can not find information about repo difference.
If you have a local repo linked to a GitHub remote repo which might have evolved, you can download and compare the difference with:
cd /path/to/local/repo
git fetch
git diff master origin/master

Adding to Github from Visual Studio 2013 not working as documented

This is the online reference I am using. However when I enter the remote repository and hit publish I get an error
You cannot publish local branch master to the remote repository origin
because a branch with the same name already exists there. You might
want to rename your local branch and try again.
I dont want to rename anything as yet. I want the first version of the code to go into the master branch and at the same time create an upstream tracking branch locally.
Then I tried using the command line only. After creating a fresh repository, I ran the following commands
$ cd (project-directory)
$ git init
$ (add some files)
$ git add .
$ git commit -m 'Initial commit'
$ git remote add origin <url>
$ git push --force
This worked but now I have all my obj,bin,packages directories along with it. I don't want all those directories to go. Editing the git ignore did not help either. What I am doing wrong? Its taken more twice the amount of time to get the code into the repository than it has taken to write the code!
I only want my sources in the repository and have a tracking local branch to begin with.

Forking Rails Tutorial sample_app for Rails 4

I'm trying to fork Michael Hartl's sample_app_rails_4 (https://github.com/railstutorial/sample_app_rails_4). I keep getting the error message:
'fatal: Could not read from remote repository.Please make sure you
have the correct access rights and the repository exists'
after entering the following commands.
$ cd /tmp
$ git clone git#github.com:railstutorial/sample_app_rails_4.git
I appreciate any help in getting this (seemingly simple) step to work.
It looks like SSH is not an option on that repository. Try
git clone https://github.com/railstutorial/sample_app_rails_4.git
Not actually forking, but that worked for me.
You need to fork the repo, get it in your personal GitHub repository, and then clone the version that is in your personal repo. Here is a GitHub article on forking and cloning: https://help.github.com/articles/fork-a-repo
Here are the steps at a high level:
Go to Hartl's repo and click fork. This will copy the project in your GitHub account.
Clone the repo from your personal account:
$ git clone git#github.com:your_github_usernamesample_app_rails_4.git