Thi thoảng khi sử dụng git chúng ta muốn push dữ liệu được clone từ một repository khác về local repository của mình để thay đổi, sửa file trong đó rồi push lên repository của mình, khi đó sẽ có một số vướng mắc xảy ra khi trong repository được clone về máy nó đang chứa các .git có dữ liệu của repository được clone về, trong đó có url remote đó vậy ta cần tinh chỉnh dữ lại bằng mẹo sau:
Xoa remote cua du an khac
Kiem tra remote hien tai
Git remote -v
Xoa remote hien tai
Git remote rm origin
Kiem tra lai remote da duoc xoa chua
Git remote -v
Neu xoa thanh cong thi bat dau khoi tao
Git init
Git remote add origin <url>
Git add <filename>
Git commit – m “message”
Git push origin master
Neu loi ref ta tien hanh go lenh ben duoi de dong bo du lieu co san tren remote respository ve local truoc:
git pull –allow-unrelated-histories origin master
Then
Git commit -m “message”
Final:
git push -u origin master
Hoac thu cach sau: Cưỡng chế việc push data lên remote repository với câu lệnh :
git push origin master –force
2 comments On Mẹo Git
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.